Skip to content

Commit 6ecd9cd

Browse files
authored
Merge pull request #162 from AuthorizeNet/future
Future
2 parents 11f5f69 + 233099e commit 6ecd9cd

10 files changed

+4436
-4217
lines changed

.github/workflows/python-workflow.yml

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Authorize.net Python CI
2+
on:
3+
push:
4+
pull_request:
5+
workflow_dispatch:
6+
env:
7+
sdk_python: 'sdk-python'
8+
sample_code_python: 'sample-code-python'
9+
jobs:
10+
workflow-job:
11+
defaults:
12+
run:
13+
shell: bash
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
operating-system: [ubuntu-latest, macos-latest, windows-latest]
18+
pyth-version: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
19+
include:
20+
- operating-system: ubuntu-20.04 # Checking support for ubuntu os with python 3.6
21+
pyth-version: '3.6'
22+
- operating-system: macos-13 # Checking support for mac os with python 3.6
23+
pyth-version: '3.6'
24+
- operating-system: macos-13 # Checking support for mac os with python 3.7
25+
pyth-version: '3.7'
26+
exclude:
27+
- operating-system: ubuntu-latest #arm 64 doesn't support python ver 3.7
28+
pyth-version: '3.6'
29+
- operating-system: macos-latest #arm 64 doesn't support python ver 3.6
30+
pyth-version: '3.6'
31+
- operating-system: macos-latest #arm 64 doesn't support python ver 3.7
32+
pyth-version: '3.7'
33+
runs-on: ${{matrix.operating-system}}
34+
steps:
35+
- name: Creating separate folders for SDK and Sample Codes
36+
run: |
37+
rm -rf $sdk_python
38+
rm -rf $sample_code_python
39+
mkdir $sdk_python $sample_code_python
40+
41+
- name: Checkout authorizenet/sdk-python
42+
uses: actions/checkout@v4
43+
with:
44+
path: ${{env.sdk_python}}
45+
46+
- name: Checkout authorizenet/sample-code-python
47+
uses: actions/checkout@v4
48+
with:
49+
repository: 'authorizenet/sample-code-python'
50+
ref: 'future' # Remove this line before pushing to master branch
51+
path: ${{env.sample_code_python}}
52+
53+
- name: Install Python
54+
uses: actions/setup-python@v5
55+
with:
56+
python-version: ${{matrix.pyth-version}}
57+
58+
- name: Install and Test
59+
run: |
60+
python -V
61+
python -m pip install --upgrade pip
62+
python -m venv virtual_env
63+
if [[ "$(uname -s)" == "Linux" ]]; then
64+
echo "OS: Linux"
65+
source virtual_env/bin/activate
66+
elif [[ "$(uname -s)" == "Darwin" ]]; then
67+
echo "OS: MacOS"
68+
source virtual_env/bin/activate
69+
else
70+
echo "OS: Windows"
71+
source virtual_env/Scripts/activate
72+
fi
73+
echo $VIRTUAL_ENV
74+
75+
cd $sdk_python
76+
pip install -e .
77+
78+
cd ../$sample_code_python
79+
python ./test-runner.py

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ var/
2323
*.egg-info/
2424
.installed.cfg
2525
*.egg
26+
packages/
2627

2728
# PyInstaller
2829
# Usually these files are written by a python script from a template

README.md

+17-32
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
# Authorize.Net Python SDK
22

3-
[![Travis CI Status](https://travis-ci.org/AuthorizeNet/sdk-python.svg?branch=master)](https://travis-ci.org/AuthorizeNet/sdk-python)
4-
[![Coverage Status](https://coveralls.io/repos/github/AuthorizeNet/sdk-python/badge.svg?branch=master)](https://coveralls.io/github/AuthorizeNet/sdk-python?branch=master)
5-
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/AuthorizeNet/sdk-python/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/AuthorizeNet/sdk-python/?branch=master)
3+
[![Authorize.net Python CI](https://github.com/AuthorizeNet/sdk-python/actions/workflows/python-workflow.yml/badge.svg?branch=master)](https://github.com/AuthorizeNet/sdk-python/actions/workflows/python-workflow.yml)
64
[![PyPI](https://img.shields.io/pypi/v/authorizenet.svg)](https://badge.fury.io/py/authorizenet)
75

86

97
## Requirements
10-
* For Python 2, Python 2.7 or greater
11-
* For Python 3, Python 3.4 or later
8+
* Python 3.6 or later
129
* OpenSSL 1.0.2 or greater
1310
* An Authorize.Net account (see _Registration & Configuration_ section below)
1411

15-
_Note: Our goal is ensuring this SDK is compatible with Python 2.7+, 3.4+ and PyPy, but at the moment we're primarily testing against Python 2.7._
16-
12+
_Note: Support for Python 2.x and Python <=3.5 has been discontinued, due to EOL of the Python package._
1713
### Contribution
1814
- If you need information or clarification about Authorize.Net features, create an issue with your question. You can also search the [Authorize.Net developer community](https://community.developer.authorize.net/) for discussions related to your question.
1915
- Before creating pull requests, please read [the contributors guide](CONTRIBUTING.md).
@@ -39,9 +35,9 @@ After you have your credentials, load them into the appropriate variables in you
3935

4036
#### To set your API credentials for an API request:
4137
```python
42-
merchantAuth = apicontractsv1.merchantAuthenticationType()
43-
merchantAuth.name = 'YOUR_API_LOGIN_ID'
44-
merchantAuth.transactionKey = 'YOUR_TRANSACTION_KEY'
38+
merchantAuth = apicontractsv1.merchantAuthenticationType()
39+
merchantAuth.name = 'YOUR_API_LOGIN_ID'
40+
merchantAuth.transactionKey = 'YOUR_TRANSACTION_KEY'
4541
```
4642

4743
Never include your API Login ID and Transaction Key directly in a file in a publicly accessible portion of your website. As a best practice, define the API Login ID and Transaction Key in a constants file, and reference those constants in your code.
@@ -50,7 +46,7 @@ Never include your API Login ID and Transaction Key directly in a file in a publ
5046
Authorize.Net maintains a complete sandbox environment for testing and development purposes. The sandbox environment is an exact replica of our production environment, with simulated transaction authorization and settlement. By default, this SDK is configured to use the sandbox environment. To switch to the production environment, use the `setenvironment` method on the controller before executing. For example:
5147
```python
5248
# For PRODUCTION use
53-
createtransactioncontroller.setenvironment(constants.PRODUCTION)
49+
createtransactioncontroller.setenvironment(constants.PRODUCTION)
5450
```
5551

5652
API credentials are different for each environment, so be sure to switch to the appropriate credentials when switching environments.
@@ -61,14 +57,14 @@ Python SDK uses the logger _'authorizenet.sdk'_. By default, the logger in the S
6157
A sample logger configuration is given as below:
6258

6359
```python
64-
import logging
65-
logger = logging.getLogger('authorizenet.sdk')
66-
handler = logging.FileHandler('anetSdk.log')
67-
formatter = logging.Formatter('%(asctime)s %(name)-12s %(levelname)-8s %(message)s')
68-
handler.setFormatter(formatter)
69-
logger.addHandler(handler)
70-
logger.setLevel(logging.DEBUG)
71-
logger.debug('Logger set up for Authorizenet Python SDK complete')
60+
import logging
61+
logger = logging.getLogger('authorizenet.sdk')
62+
handler = logging.FileHandler('anetSdk.log')
63+
formatter = logging.Formatter('%(asctime)s %(name)-12s %(levelname)-8s %(message)s')
64+
handler.setFormatter(formatter)
65+
logger.addHandler(handler)
66+
logger.setLevel(logging.DEBUG)
67+
logger.debug('Logger set up for Authorizenet Python SDK complete')
7268
```
7369

7470

@@ -103,19 +99,8 @@ When using the SDK to submit Chase Pay transactions, consider the following poin
10399
## Building & Testing the SDK
104100

105101
### Requirements
106-
- python 2.7
107-
- pyxb 1.2.5
108-
109-
Run the following to get pyxb and nosetests:
110-
- pip install pyxb==1.2.5
111-
- pip install nose
112-
- pip install lxml
113-
114-
### Running the SDK Tests
115-
- Tests available are: unit tests, mock tests, sample code
116-
- use nosetests to run all unittests
117-
118-
`>nosetests`
102+
- Python 3.6
103+
- PyXB-X
119104

120105
### Testing Guide
121106
For additional help in testing your own code, Authorize.Net maintains a [comprehensive testing guide](http://developer.authorize.net/hello_world/testing_guide/) that includes test credit card numbers to use and special triggers to generate certain responses from the sandbox environment.

0 commit comments

Comments
 (0)