diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..859b1d8 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,66 @@ +--- +name: Build & publish +on: [push] +jobs: + + build: + name: Build wheel + # only build on tag pushes + if: startsWith(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.8" + + - name: Install hatch + run: python3 -m pip install hatch --user + + - name: Build + run: hatch build -t wheel + + - name: Save wheel as artifact + uses: actions/upload-artifact@v4 + with: + name: python-package-distributions + path: dist/ + + publish: + name: Create GitHub release & publish to PyPI + # only publish to PyPI on tag pushes + if: startsWith(github.ref, 'refs/tags/') + needs: + - build + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/rocketgate + permissions: + id-token: write + + steps: + - name: Environment + run: echo "RELEASE_VERSION=$(git describe --tags)" > $GITHUB_ENV + + - name: Download wheel artifact + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + + - name: GitHub Release + uses: softprops/action-gh-release@v1 + with: + body: ${{ github.event.workflow_run.head_commit.message }} + files: dist/rocketgate-${{ env.RELEASE_VERSION }}.whl + + - name: Publish + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ diff --git a/.gitignore b/.gitignore index 08688d4..f8bbc84 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,6 @@ __pycache__ tests/__pycache__ tests/.DS_Store .DS_Store -/venv \ No newline at end of file +/venv +/.venv +/dist diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..38e90c3 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +Copyright notice: +(c) Copyright 2024 RocketGate +All rights reserved. + +The copyright notice must not be removed without specific, prior +written permission from RocketGate. + +This software is protected as an unpublished work under the U.S. copyright +laws. The above copyright notice is not intended to effect a publication of +this work. +This software is the confidential and proprietary information of RocketGate. +Neither the binaries nor the source code may be redistributed without prior +written permission from RocketGate. + +The software is provided "as-is" and without warranty of any kind, express, implied +or otherwise, including without limitation, any warranty of merchantability or fitness +for a particular purpose. In no event shall RocketGate be liable for any direct, +special, incidental, indirect, consequential or other damages of any kind, or any damages +whatsoever arising out of or in connection with the use or performance of this software, +including, without limitation, damages resulting from loss of use, data or profits, and +whether or not advised of the possibility of damage, regardless of the theory of liability. \ No newline at end of file diff --git a/README.md b/README.md index b020207..fca0717 100644 --- a/README.md +++ b/README.md @@ -19,4 +19,69 @@ Docs related to this repository are located at: From the root of the project, using your installed Python Interpreter, run the following command: ```shell python3 -m unittest discover ./tests -p '*.py' +``` + +## Install RocketGate SDK +```shell +pip install RocketGate +``` + +## Run examples + +Clone this repository and run examples from `./examples` folder +with `python3 ./examples/AuthOnly.py` + +```bash +cd ~ +git clone https://github.com/rocketgate/rocketgate-python-sdk +cd ~/rocketgate-python-sdk +python3 ./examples/AuthOnly.py +``` + + +Expect to see output like: + +```bash +Auth Only succeeded +GUID: 100019354857297 +Response Code: 0 +Reason Code: 0 +AuthNo: 942499 +AVS: None +CVV2: None +Card Hash: 8Yz0jmvTGdDaZV9g58L+9mJ+0jw2fodvgktC/jS8GSs= +Card Region: 1,2 +Card Description: CLASSIC +Account: 70 +Scrub: NEGDB=0,PROFILE=0,ACTIVITY=1 +``` + +## Using your local github clone for testing +If you want to test the modifications of your local version +set `PYTHONPATH` env variable with the path to your +local repository and you can run examples from `./examples` folder. + +```bash +cd ~ +git clone https://github.com/rocketgate/rocketgate-python-sdk +cd ~/rocketgate-python-sdk +export PYTHONPATH=~/rocketgate-python-sdk +python3 ./examples/AuthOnly.py +``` + +Expect to see output like: + +```bash +Auth Only succeeded +GUID: 10001935007BB5F +Response Code: 0 +Reason Code: 0 +AuthNo: 400966 +AVS: None +CVV2: None +Card Hash: 8Yz0jmvTGdDaZV9g58L+9mJ+0jw2fodvgktC/jS8GSs= +Card Region: 1,2 +Card Description: CLASSIC +Account: 70 +Scrub: NEGDB=0,PROFILE=0,ACTIVITY=1 ``` \ No newline at end of file diff --git a/examples/1Click-CrossMerchant_wCardHash.py b/examples/1Click-CrossMerchant_wCardHash.py index 1ce2802..1bc0478 100644 --- a/examples/1Click-CrossMerchant_wCardHash.py +++ b/examples/1Click-CrossMerchant_wCardHash.py @@ -26,7 +26,7 @@ import time import sys import os -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + from RocketGate import * """ diff --git a/examples/1Click-CrossMerchant_wPayInfoToken.py b/examples/1Click-CrossMerchant_wPayInfoToken.py index d0e7e48..a66381f 100644 --- a/examples/1Click-CrossMerchant_wPayInfoToken.py +++ b/examples/1Click-CrossMerchant_wPayInfoToken.py @@ -26,7 +26,7 @@ import time import sys import os -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + from RocketGate import * """ diff --git a/examples/1Click-WithCardHash.py b/examples/1Click-WithCardHash.py index 7493547..0959bdf 100644 --- a/examples/1Click-WithCardHash.py +++ b/examples/1Click-WithCardHash.py @@ -26,7 +26,7 @@ import time import sys import os -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + from RocketGate import * """ diff --git a/examples/1Click-WithPayInfoToken.py b/examples/1Click-WithPayInfoToken.py index 1615cbb..baf0832 100644 --- a/examples/1Click-WithPayInfoToken.py +++ b/examples/1Click-WithPayInfoToken.py @@ -26,7 +26,7 @@ import time import sys import os -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + from RocketGate import * """ diff --git a/examples/ACH.py b/examples/ACH.py index fd44125..32a09d3 100644 --- a/examples/ACH.py +++ b/examples/ACH.py @@ -26,7 +26,7 @@ import time import sys import os -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + from RocketGate import * # Allocate the objects needed for the test diff --git a/examples/AuthOnly.py b/examples/AuthOnly.py index 89cab55..bcb0ff5 100644 --- a/examples/AuthOnly.py +++ b/examples/AuthOnly.py @@ -26,7 +26,7 @@ import time import sys import os -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + from RocketGate import * the_time = str(int(time.time())) diff --git a/examples/AuthTicket.py b/examples/AuthTicket.py index 920e8ad..a130e36 100644 --- a/examples/AuthTicket.py +++ b/examples/AuthTicket.py @@ -26,7 +26,7 @@ import time import sys import os -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + from RocketGate import * the_time = str(int(time.time())) diff --git a/examples/AuthVoid.py b/examples/AuthVoid.py index c93abe1..731561c 100644 --- a/examples/AuthVoid.py +++ b/examples/AuthVoid.py @@ -26,7 +26,7 @@ import time import sys import os -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + from RocketGate import * diff --git a/examples/Cancel.py b/examples/Cancel.py index ddca9f1..04d8d87 100644 --- a/examples/Cancel.py +++ b/examples/Cancel.py @@ -26,7 +26,7 @@ import time import sys import os -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + from RocketGate import * the_time = str(int(time.time())) diff --git a/examples/CancelPromo.py b/examples/CancelPromo.py index 0d1c949..16e7cbc 100644 --- a/examples/CancelPromo.py +++ b/examples/CancelPromo.py @@ -26,7 +26,7 @@ import time import sys import os -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + from RocketGate import * """ diff --git a/examples/CardScrub.py b/examples/CardScrub.py index 151327e..a5457a4 100644 --- a/examples/CardScrub.py +++ b/examples/CardScrub.py @@ -25,7 +25,7 @@ import sys import os -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + from RocketGate import * cust_id = "CardScrubTest" diff --git a/examples/GenerateXsell.py b/examples/GenerateXsell.py index b073b73..afe21e0 100644 --- a/examples/GenerateXsell.py +++ b/examples/GenerateXsell.py @@ -26,7 +26,7 @@ import time import sys import os -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + from RocketGate import * """ diff --git a/examples/InstantUpgrade.py b/examples/InstantUpgrade.py index d630c8c..f6b76bc 100644 --- a/examples/InstantUpgrade.py +++ b/examples/InstantUpgrade.py @@ -26,7 +26,7 @@ import time import sys import os -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + from RocketGate import * """ diff --git a/examples/Lookup.py b/examples/Lookup.py index baccc7e..dfdd6b8 100644 --- a/examples/Lookup.py +++ b/examples/Lookup.py @@ -26,7 +26,7 @@ import time import sys import os -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + from RocketGate import * # Setup required and testing variables diff --git a/examples/NonRebillUpdateToRebill.py b/examples/NonRebillUpdateToRebill.py index d9df4f8..adbcc38 100644 --- a/examples/NonRebillUpdateToRebill.py +++ b/examples/NonRebillUpdateToRebill.py @@ -26,7 +26,7 @@ import time import sys import os -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + from RocketGate import * """ diff --git a/examples/ProratedUpgrade.py b/examples/ProratedUpgrade.py index 2d9a2c6..90278ab 100644 --- a/examples/ProratedUpgrade.py +++ b/examples/ProratedUpgrade.py @@ -26,7 +26,7 @@ import time import sys import os -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + from RocketGate import * """ diff --git a/examples/Purchase.py b/examples/Purchase.py index 7d4c691..4fcbd7d 100644 --- a/examples/Purchase.py +++ b/examples/Purchase.py @@ -26,7 +26,7 @@ import time import sys import os -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + from RocketGate import * the_time = str(int(time.time())) diff --git a/examples/PurchaseCredit.py b/examples/PurchaseCredit.py index 999d858..61fdfbb 100644 --- a/examples/PurchaseCredit.py +++ b/examples/PurchaseCredit.py @@ -26,7 +26,7 @@ import time import sys import os -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + from RocketGate import * # Setup required and testing variables diff --git a/examples/PurchaseLifetimeMembership.py b/examples/PurchaseLifetimeMembership.py index 747834b..7a041df 100644 --- a/examples/PurchaseLifetimeMembership.py +++ b/examples/PurchaseLifetimeMembership.py @@ -26,7 +26,7 @@ import time import sys import os -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + from RocketGate import * # Allocate the objects needed for the test diff --git a/examples/PurchaseRebill.py b/examples/PurchaseRebill.py index b1be917..59d1076 100644 --- a/examples/PurchaseRebill.py +++ b/examples/PurchaseRebill.py @@ -26,7 +26,7 @@ import time import sys import os -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + from RocketGate import * the_time = str(int(time.time())) diff --git a/examples/PurchaseTrialToLifetimeMembership.py b/examples/PurchaseTrialToLifetimeMembership.py index 15b22d1..50a981a 100644 --- a/examples/PurchaseTrialToLifetimeMembership.py +++ b/examples/PurchaseTrialToLifetimeMembership.py @@ -26,7 +26,7 @@ import time import sys import os -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + from RocketGate import * # Allocate the objects needed for the test diff --git a/examples/RebillReactivate.py b/examples/RebillReactivate.py index 9376cd3..96f1358 100644 --- a/examples/RebillReactivate.py +++ b/examples/RebillReactivate.py @@ -25,7 +25,7 @@ import sys import os -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + from RocketGate import * """ diff --git a/examples/RebillStatus.py b/examples/RebillStatus.py index 88d5b40..a18c688 100644 --- a/examples/RebillStatus.py +++ b/examples/RebillStatus.py @@ -26,7 +26,7 @@ import time import sys import os -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + from RocketGate import * # Setup a couple required and testing variables diff --git a/examples/RebillStatusCancelled.py b/examples/RebillStatusCancelled.py index 46c7958..62c3244 100644 --- a/examples/RebillStatusCancelled.py +++ b/examples/RebillStatusCancelled.py @@ -26,7 +26,7 @@ import time import sys import os -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + from RocketGate import * # Allocate the objects needed for the test diff --git a/examples/Test3DSecure.py b/examples/Test3DSecure.py index 946e9c3..9c0b6de 100644 --- a/examples/Test3DSecure.py +++ b/examples/Test3DSecure.py @@ -26,7 +26,7 @@ import time import sys import os -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + from RocketGate import * # Allocate the objects we need for the test diff --git a/examples/Test3DSecure_2_0.py b/examples/Test3DSecure_2_0.py index 6ac7262..9b2f2a4 100644 --- a/examples/Test3DSecure_2_0.py +++ b/examples/Test3DSecure_2_0.py @@ -26,7 +26,7 @@ import time import sys import os -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + from RocketGate import * # Object instantiation diff --git a/examples/Test3DSecure_2_0_AlternateDeviceFingerprinting.py b/examples/Test3DSecure_2_0_AlternateDeviceFingerprinting.py index f3f3a92..6270d4a 100644 --- a/examples/Test3DSecure_2_0_AlternateDeviceFingerprinting.py +++ b/examples/Test3DSecure_2_0_AlternateDeviceFingerprinting.py @@ -26,7 +26,7 @@ import time import sys import os -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + from RocketGate import * # Setup the request, response, and service objects diff --git a/examples/UpdatePI.py b/examples/UpdatePI.py index f86902c..b290244 100644 --- a/examples/UpdatePI.py +++ b/examples/UpdatePI.py @@ -26,7 +26,7 @@ import time import sys import os -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + from RocketGate import * diff --git a/examples/UpdateStickyMid.py b/examples/UpdateStickyMid.py index f5eab59..ce381a2 100644 --- a/examples/UpdateStickyMid.py +++ b/examples/UpdateStickyMid.py @@ -26,7 +26,7 @@ import time import os import sys -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + from RocketGate import * # Setup a couple required and testing variables diff --git a/examples/Upload.py b/examples/Upload.py index cf4371a..2f8b3e5 100644 --- a/examples/Upload.py +++ b/examples/Upload.py @@ -25,7 +25,7 @@ import sys import os -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + from RocketGate import * import time diff --git a/examples/UsePrimarySchemeID.py b/examples/UsePrimarySchemeID.py index fe2612a..2bdee7f 100644 --- a/examples/UsePrimarySchemeID.py +++ b/examples/UsePrimarySchemeID.py @@ -26,7 +26,7 @@ import time import sys import os -sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + from RocketGate import * # Allocate the objects we need for the test. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..7ad8cd1 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,25 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "rg_brad_test" +version = "3.9" +authors = [ + {name="RocketGate"}, +] +description = "RocketGate Gateway Python SDK" +readme = "README.md" +requires-python = ">=3.8" +classifiers = [ + "Programming Language :: Python :: 3", + "Operating System :: OS Independent", +] + +[tool.hatch.build] +include = [ + "RocketGate.py" +] + +[project.urls] +"Homepage" = "https://github.com/rocketgate/rocketgate-python-sdk"