-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
WorldlineAcquiring
committed
Sep 20, 2024
1 parent
cd50ca1
commit ac15542
Showing
206 changed files
with
14,420 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 4 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.rst] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.gitattributes export-ignore | ||
.gitignore export-ignore | ||
|
||
* text eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: API docs | ||
|
||
on: | ||
push: | ||
tags: ['[0-9]+.[0-9]+*'] | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
api-docs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
path: code | ||
persist-credentials: false | ||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
- name: Install Sphinx and dependencies | ||
run: pip install sphinx requests==2.* requests-toolbelt==0.* appengine-python-standard | ||
- name: Build API docs | ||
run: sphinx-build . docs | ||
working-directory: code | ||
- name: Checkout pages | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: gh-pages | ||
path: pages | ||
- name: Deploy pages | ||
run: | | ||
SDK_VERSION_FOLDER=`echo "$SDK_VERSION" | awk --field-separator '.' '{print $1".x";}'` | ||
# Create .nojekyll if it doesn't exist yet | ||
touch .nojekyll | ||
mkdir -p "$SDK_VERSION_FOLDER" | ||
rsync --quiet --archive --checksum --delete --exclude .git ../code/docs/ "$SDK_VERSION_FOLDER/" | ||
# Remove .buildinfo and .doctrees generated by Sphinx | ||
if [ -f "$SDK_VERSION_FOLDER/.buildinfo" ]; then rm "$SDK_VERSION_FOLDER/.buildinfo"; fi | ||
if [ -d "$SDK_VERSION_FOLDER/.doctrees" ]; then rm -r "$SDK_VERSION_FOLDER/.doctrees"; fi | ||
if [ -e latest ]; then rm -r latest; fi | ||
ln -s "$SDK_VERSION_FOLDER" latest | ||
git config user.email "$USER_EMAIL" | ||
git config user.name "$USER_NAME" | ||
git add --all . | ||
# Only commit when there are changes | ||
git diff --quiet && git diff --staged --quiet || git commit --message "Generated API docs for version ${SDK_VERSION}" | ||
git push | ||
shell: bash | ||
working-directory: pages | ||
env: | ||
SDK_VERSION: ${{ github.ref_name }} | ||
USER_EMAIL: ${{ github.event.pusher.email }} | ||
USER_NAME: ${{ github.event.pusher.name }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Deploy | ||
|
||
on: | ||
push: | ||
tags: ['[0-9]+.[0-9]+*'] | ||
|
||
env: | ||
SDK_VERSION: ${{ github.ref_name }} | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
persist-credentials: false | ||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
- name: Install Twine and dependencies | ||
run: pip install twine requests==2.* requests-toolbelt==0.* appengine-python-standard | ||
- name: Build | ||
run: python setup.py sdist --formats zip --dist-dir . | ||
- name: Verify | ||
run: twine check "acquiring-sdk-python-${SDK_VERSION}.zip" | ||
- name: Deploy | ||
run: twine upload --username "${PYPI_USERNAME}" --password "${PYPI_PASSWORD}" "acquiring-sdk-python-${SDK_VERSION}.zip" | ||
env: | ||
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
.idea/ | ||
.settings/ | ||
.project | ||
.pydevproject | ||
.vscode/ | ||
main_test.py | ||
|
||
#python gitignote template from github | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
env/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*,cover | ||
.hypothesis/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Copyright (c) 2024 Worldline Financial Services (Europe) SA | ||
|
||
Permission is hereby granted, free of charge, to any person | ||
obtaining a copy of this software and associated documentation | ||
files (the "Software"), to deal in the Software without | ||
restriction, including without limitation the rights to use, | ||
copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the | ||
Software is furnished to do so, subject to the following | ||
conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
include README.rst | ||
include LICENSE.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
Worldline Acquiring Python SDK | ||
============================== | ||
|
||
Introduction | ||
------------ | ||
|
||
The Python SDK helps you to communicate with the Worldline Acquiring API. Its primary features are: | ||
|
||
- convenient Python library for the API calls and responses | ||
|
||
- marshals Python request objects to HTTP requests | ||
- unmarshals HTTP responses to Python response objects or Python exceptions | ||
|
||
- handling of all the details concerning authentication | ||
- handling of required metadata | ||
|
||
See the `Worldline Acquiring Documentation <https://docs.acquiring.worldline-solutions.com/Developer-Tools/sdk/python>`__ for more information on how to use the SDK. | ||
|
||
Structure of this repository | ||
---------------------------- | ||
|
||
This repository consists out of four main components: | ||
|
||
#. The source code of the SDK itself: ``/worldline/acquiring/sdk/`` | ||
#. The source code of the SDK unit tests: ``/tests/unit/`` | ||
#. The source code of the SDK integration tests: ``/tests/integration/`` | ||
|
||
Note that the source code of the unit tests and integration tests can only be found on GitHub. | ||
|
||
Requirements | ||
------------ | ||
|
||
Python 3.7 or higher is required. In addition, the following packages are required: | ||
|
||
- `requests <https://requests.readthedocs.io/>`__ 2.25.0 or higher | ||
- `requests-toolbelt <https://toolbelt.readthedocs.io/>`__ 0.8.0 or higher | ||
|
||
These packages will be installed automatically if the SDK is installed manually or using pip following the below instructions. | ||
|
||
Installation | ||
------------ | ||
|
||
To install the SDK using pip, execute the following command: | ||
|
||
.. code:: bash | ||
pip install acquiring-sdk-python | ||
Alternatively, you can install the SDK from a source distribution file: | ||
|
||
#. Download the latest version of the Python SDK from GitHub. Choose the ``acquiring-sdk-python-x.y.z.zip`` file from the `releases <https://github.com/Worldline-Acquiring/acquiring-sdk-python/releases>`__ page, where ``x.y.z`` is the version number. | ||
|
||
#. Execute the following command in the folder where the SDK was downloaded to: | ||
|
||
.. code:: bash | ||
pip install acquiring-sdk-python-x.y.z.zip | ||
Uninstalling | ||
------------ | ||
|
||
After the Python SDK has been installed, it can be uninstalled using the following command: | ||
|
||
.. code:: bash | ||
pip uninstall acquiring-sdk-python | ||
The required packages can be uninstalled in the same way. | ||
|
||
Running tests | ||
------------- | ||
|
||
There are two types of tests: unit tests and integration tests. The unit tests will work out-of-the-box; for the integration tests some configuration is required. | ||
First, some environment variables need to be set: | ||
|
||
- ``acquiring.api.oauth2.clientId`` for the OAUth2 client id to use. | ||
- ``acquiring.api.oauth2.clientSecret`` for the OAuth2 client secret to use. | ||
- ``acquiring.api.merchantId`` for your merchant ID. | ||
|
||
In addition, to run the proxy integration tests, the proxy URI, username and password should be set in the ``tests/resources/configuration.proxy.ini`` file. | ||
|
||
In order to run the unit and integration tests, the `mock <https://pypi.python.org/pypi/mock>`__ backport and `mockito <https://pypi.python.org/pypi/mockito>`__ are required. These can be installed using the following command: | ||
|
||
.. code:: bash | ||
pip install mock mockito | ||
The following commands can now be executed from the ``tests`` directory to execute the tests: | ||
|
||
- Unit tests: | ||
|
||
.. code:: bash | ||
python run_unit_tests.py | ||
- Integration tests: | ||
|
||
.. code:: bash | ||
python run_integration_tests.py | ||
- Both unit and integration tests: | ||
|
||
.. code:: bash | ||
python run_all_tests.py |
Oops, something went wrong.