From c0ea7795aa5f1e043099058f822ef1596de44f65 Mon Sep 17 00:00:00 2001 From: Petrica Chiriac Date: Tue, 5 Nov 2024 19:10:56 +0200 Subject: [PATCH 1/9] Prepare RocketGate 3.6 package --- LICENSE | 21 ++++++++++++ README.md | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++ pyproject.toml | 25 ++++++++++++++ 3 files changed, 136 insertions(+) create mode 100644 LICENSE create mode 100644 pyproject.toml 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..1a44c36 100644 --- a/README.md +++ b/README.md @@ -19,4 +19,94 @@ 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 +``` + +## Example + +Save next `python` code in `AuthOnly.py` file and +run with `python3 AuthOnly.py` + +```python +from RocketGate import * + +request = GatewayRequest() +response = GatewayResponse() +service = GatewayService() + +request.Set(GatewayRequest.MERCHANT_ID, "1") +request.Set(GatewayRequest.MERCHANT_PASSWORD, "testpassword") + +request.Set(GatewayRequest.MERCHANT_CUSTOMER_ID, "My.PythonTest") +request.Set(GatewayRequest.MERCHANT_INVOICE_ID, "My.Invoice") + +request.Set(GatewayRequest.AMOUNT, 9.99) +request.Set(GatewayRequest.CURRENCY, "USD") + +request.Set(GatewayRequest.CARDNO, "4111111111111111") +request.Set(GatewayRequest.EXPIRE_MONTH, "02") +request.Set(GatewayRequest.EXPIRE_YEAR, "2030") +request.Set(GatewayRequest.CVV2, "999") + +request.Set(GatewayRequest.BILLING_ADDRESS, "123 Main St") +request.Set(GatewayRequest.BILLING_CITY, "Las Vegas") +request.Set(GatewayRequest.BILLING_STATE, "NV") +request.Set(GatewayRequest.BILLING_ZIPCODE, "89141") +request.Set(GatewayRequest.BILLING_COUNTRY, "US") + +request.Set(GatewayRequest.CUSTOMER_FIRSTNAME, "Joe") +request.Set(GatewayRequest.CUSTOMER_LASTNAME, "PythonTester") +request.Set(GatewayRequest.EMAIL, "python_user@fakedomain.com") +request.Set(GatewayRequest.IPADDRESS, "68.224.133.117") + +request.Set(GatewayRequest.AVS_CHECK, "IGNORE") +request.Set(GatewayRequest.CVV2_CHECK, "IGNORE") +request.Set(GatewayRequest.SCRUB, "IGNORE") + +service.SetTestMode(1) + +# Perform the Auth-Only transaction. +if service.PerformAuthOnly(request, response): + print("Auth Only succeeded") + print("GUID: ", response.Get(GatewayResponse.TRANSACT_ID)) + print("Response Code: ", response.Get(GatewayResponse.RESPONSE_CODE)) + print("Reason Code: ", response.Get(GatewayResponse.REASON_CODE)) + print("AuthNo: ", response.Get(GatewayResponse.AUTH_NO)) + print("AVS: ", response.Get(GatewayResponse.AVS_RESPONSE)) + print("CVV2: ", response.Get(GatewayResponse.CVV2_CODE)) + print("Card Hash: ", response.Get(GatewayResponse.CARD_HASH)) + print("Card Region: ", response.Get(GatewayResponse.CARD_REGION)) + print("Card Description: ", response.Get(GatewayResponse.CARD_DESCRIPTION)) + print("Account: ", response.Get(GatewayResponse.MERCHANT_ACCOUNT)) + print("Scrub: ", response.Get(GatewayResponse.SCRUB_RESULTS)) + +else: + print("Auth Only failed") + print("GUID: ", response.Get(GatewayResponse.TRANSACT_ID)) + print("Response Code: ", response.Get(GatewayResponse.RESPONSE_CODE)) + print("Reason Code: ", response.Get(GatewayResponse.REASON_CODE)) + print("Exception: ", response.Get(GatewayResponse.EXCEPTION)) + print("Scrub: ", response.Get(GatewayResponse.SCRUB_RESULTS)) + +``` + +Expect to see output like: + +```bash +Auth Only succeeded +GUID: 1000192FD2DED89 +Response Code: 0 +Reason Code: 0 +AuthNo: 985828 +AVS: Y +CVV2: None +Card Hash: 8Yz0jmvTGdDaZV9g58L+9mJ+0jw2fodvgktC/jS8GSs= +Card Region: 1,2 +Card Description: CLASSIC +Account: 14 +Scrub: NEGDB=0,PROFILE=0,ACTIVITY=1 ``` \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..d8e17e6 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,25 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "RocketGate" +version = "3.6" +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" From 4f7b85bdb28278b23f9aa229ead7e8a203f5d41a Mon Sep 17 00:00:00 2001 From: Petrica Chiriac Date: Tue, 5 Nov 2024 20:57:41 +0200 Subject: [PATCH 2/9] Ignore ./dist folder from git --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 08688d4..ad551fc 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ __pycache__ tests/__pycache__ tests/.DS_Store .DS_Store -/venv \ No newline at end of file +/venv +/dist \ No newline at end of file From 6ccee0289f6ee79bb52307b55b3a4cb9dbd6cbc1 Mon Sep 17 00:00:00 2001 From: Petrica Chiriac Date: Thu, 21 Nov 2024 20:51:21 +0200 Subject: [PATCH 3/9] Clean sys.path.insert path insert. Add README.md local testing note based on PYTHONPATH env var. --- README.md | 30 +++++++++++++++++++ examples/1Click-CrossMerchant_wCardHash.py | 2 +- .../1Click-CrossMerchant_wPayInfoToken.py | 2 +- examples/1Click-WithCardHash.py | 2 +- examples/1Click-WithPayInfoToken.py | 2 +- examples/ACH.py | 2 +- examples/AuthOnly.py | 2 +- examples/AuthTicket.py | 2 +- examples/AuthVoid.py | 2 +- examples/Cancel.py | 2 +- examples/CancelPromo.py | 2 +- examples/CardScrub.py | 2 +- examples/GenerateXsell.py | 2 +- examples/InstantUpgrade.py | 2 +- examples/Lookup.py | 2 +- examples/NonRebillUpdateToRebill.py | 2 +- examples/ProratedUpgrade.py | 2 +- examples/Purchase.py | 2 +- examples/PurchaseCredit.py | 2 +- examples/PurchaseLifetimeMembership.py | 2 +- examples/PurchaseRebill.py | 2 +- examples/PurchaseTrialToLifetimeMembership.py | 2 +- examples/RebillReactivate.py | 2 +- examples/RebillStatus.py | 2 +- examples/RebillStatusCancelled.py | 2 +- examples/Test3DSecure.py | 2 +- examples/Test3DSecure_2_0.py | 2 +- ...ecure_2_0_AlternateDeviceFingerprinting.py | 2 +- examples/UpdatePI.py | 2 +- examples/UpdateStickyMid.py | 2 +- examples/Upload.py | 2 +- examples/UsePrimarySchemeID.py | 2 +- 32 files changed, 61 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 1a44c36..eb93ca2 100644 --- a/README.md +++ b/README.md @@ -109,4 +109,34 @@ Card Region: 1,2 Card Description: CLASSIC Account: 14 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. From c7a6cff2f30cecb5fe1ca867b31ed73795c084c6 Mon Sep 17 00:00:00 2001 From: Petrica Chiriac Date: Fri, 22 Nov 2024 17:45:39 +0200 Subject: [PATCH 4/9] Remove python code from README.md --- README.md | 83 ++++++++++--------------------------------------------- 1 file changed, 14 insertions(+), 69 deletions(-) diff --git a/README.md b/README.md index eb93ca2..fca0717 100644 --- a/README.md +++ b/README.md @@ -26,88 +26,33 @@ python3 -m unittest discover ./tests -p '*.py' pip install RocketGate ``` -## Example - -Save next `python` code in `AuthOnly.py` file and -run with `python3 AuthOnly.py` - -```python -from RocketGate import * - -request = GatewayRequest() -response = GatewayResponse() -service = GatewayService() - -request.Set(GatewayRequest.MERCHANT_ID, "1") -request.Set(GatewayRequest.MERCHANT_PASSWORD, "testpassword") - -request.Set(GatewayRequest.MERCHANT_CUSTOMER_ID, "My.PythonTest") -request.Set(GatewayRequest.MERCHANT_INVOICE_ID, "My.Invoice") - -request.Set(GatewayRequest.AMOUNT, 9.99) -request.Set(GatewayRequest.CURRENCY, "USD") - -request.Set(GatewayRequest.CARDNO, "4111111111111111") -request.Set(GatewayRequest.EXPIRE_MONTH, "02") -request.Set(GatewayRequest.EXPIRE_YEAR, "2030") -request.Set(GatewayRequest.CVV2, "999") - -request.Set(GatewayRequest.BILLING_ADDRESS, "123 Main St") -request.Set(GatewayRequest.BILLING_CITY, "Las Vegas") -request.Set(GatewayRequest.BILLING_STATE, "NV") -request.Set(GatewayRequest.BILLING_ZIPCODE, "89141") -request.Set(GatewayRequest.BILLING_COUNTRY, "US") - -request.Set(GatewayRequest.CUSTOMER_FIRSTNAME, "Joe") -request.Set(GatewayRequest.CUSTOMER_LASTNAME, "PythonTester") -request.Set(GatewayRequest.EMAIL, "python_user@fakedomain.com") -request.Set(GatewayRequest.IPADDRESS, "68.224.133.117") - -request.Set(GatewayRequest.AVS_CHECK, "IGNORE") -request.Set(GatewayRequest.CVV2_CHECK, "IGNORE") -request.Set(GatewayRequest.SCRUB, "IGNORE") - -service.SetTestMode(1) - -# Perform the Auth-Only transaction. -if service.PerformAuthOnly(request, response): - print("Auth Only succeeded") - print("GUID: ", response.Get(GatewayResponse.TRANSACT_ID)) - print("Response Code: ", response.Get(GatewayResponse.RESPONSE_CODE)) - print("Reason Code: ", response.Get(GatewayResponse.REASON_CODE)) - print("AuthNo: ", response.Get(GatewayResponse.AUTH_NO)) - print("AVS: ", response.Get(GatewayResponse.AVS_RESPONSE)) - print("CVV2: ", response.Get(GatewayResponse.CVV2_CODE)) - print("Card Hash: ", response.Get(GatewayResponse.CARD_HASH)) - print("Card Region: ", response.Get(GatewayResponse.CARD_REGION)) - print("Card Description: ", response.Get(GatewayResponse.CARD_DESCRIPTION)) - print("Account: ", response.Get(GatewayResponse.MERCHANT_ACCOUNT)) - print("Scrub: ", response.Get(GatewayResponse.SCRUB_RESULTS)) - -else: - print("Auth Only failed") - print("GUID: ", response.Get(GatewayResponse.TRANSACT_ID)) - print("Response Code: ", response.Get(GatewayResponse.RESPONSE_CODE)) - print("Reason Code: ", response.Get(GatewayResponse.REASON_CODE)) - print("Exception: ", response.Get(GatewayResponse.EXCEPTION)) - print("Scrub: ", response.Get(GatewayResponse.SCRUB_RESULTS)) +## 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: 1000192FD2DED89 +GUID: 100019354857297 Response Code: 0 Reason Code: 0 -AuthNo: 985828 -AVS: Y +AuthNo: 942499 +AVS: None CVV2: None Card Hash: 8Yz0jmvTGdDaZV9g58L+9mJ+0jw2fodvgktC/jS8GSs= Card Region: 1,2 Card Description: CLASSIC -Account: 14 +Account: 70 Scrub: NEGDB=0,PROFILE=0,ACTIVITY=1 ``` From 50ee9cf502ec88108dc176ff2558d977aba5b7a5 Mon Sep 17 00:00:00 2001 From: Brad Johnson Date: Mon, 25 Aug 2025 16:17:03 -0600 Subject: [PATCH 5/9] Add workflow --- .github/workflows/release.yml | 62 +++++++++++++++++++++++++++++++++++ .gitignore | 3 +- 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..1ff1f81 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,62 @@ +--- +name: Build & publish + +jobs: + + build: + name: Build wheel + 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 diff --git a/.gitignore b/.gitignore index ad551fc..f8bbc84 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ tests/__pycache__ tests/.DS_Store .DS_Store /venv -/dist \ No newline at end of file +/.venv +/dist From 700d9ce1ec21c4153cbb5815d3037adb3bba9f6e Mon Sep 17 00:00:00 2001 From: Brad Johnson Date: Mon, 25 Aug 2025 16:23:25 -0600 Subject: [PATCH 6/9] Change package name for testing --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d8e17e6..7ad8cd1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,8 +3,8 @@ requires = ["hatchling"] build-backend = "hatchling.build" [project] -name = "RocketGate" -version = "3.6" +name = "rg_brad_test" +version = "3.9" authors = [ {name="RocketGate"}, ] From e8b164882beab9221e253b6d536b10d85363d4c6 Mon Sep 17 00:00:00 2001 From: Brad Johnson Date: Mon, 25 Aug 2025 16:23:43 -0600 Subject: [PATCH 7/9] Add trigger --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1ff1f81..eb4d076 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,6 @@ --- name: Build & publish - +on: [push] jobs: build: From b0d1ab60293d4c6391dbf56aa219469f76b7b9f4 Mon Sep 17 00:00:00 2001 From: Brad Johnson Date: Mon, 25 Aug 2025 16:25:49 -0600 Subject: [PATCH 8/9] Add workflow --- .github/workflows/release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eb4d076..59f485c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,6 +5,8 @@ jobs: build: name: Build wheel + # only build on tag pushes + if: startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-latest steps: From 186c0a462e81d54224a7b493831111b301b98c23 Mon Sep 17 00:00:00 2001 From: Brad Johnson Date: Mon, 25 Aug 2025 16:49:46 -0600 Subject: [PATCH 9/9] Publish to test PyPI --- .github/workflows/release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 59f485c..859b1d8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -62,3 +62,5 @@ jobs: - name: Publish uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/