Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Authorize net integration (#6465)

David Burked94c7f830b82
diff --git a/.isort.cfg b/.isort.cfg
index c4efe71a05..8b5a0f49ae 100644
--- a/.isort.cfg
+++ b/.isort.cfg
@@ -1,2 +1,2 @@
[settings]
-known_third_party = Adyen,PIL,babel,boto3,braintree,celery,dj_database_url,dj_email_url,django,django_cache_url,django_countries,django_filters,django_measurement,django_prices,django_prices_openexchangerates,django_prices_vatlayer,draftjs_sanitizer,faker,freezegun,geolite2,google,google_measurement_protocol,graphene,graphene_django,graphene_federation,graphql,graphql_relay,html_to_draftjs,i18naddress,jaeger_client,jwt,kombu,markdown,measurement,mptt,oauthlib,openpyxl,opentracing,petl,phonenumber_field,phonenumbers,pkg_resources,prices,promise,pytest,pythonjsonlogger,pytimeparse,pytz,razorpay,requests,sentry_sdk,storages,stripe,templated_email,tqdm,urllib3,versatileimagefield,weasyprint
+known_third_party = Adyen,PIL,authorizenet,babel,boto3,braintree,celery,dj_database_url,dj_email_url,django,django_cache_url,django_countries,django_filters,django_measurement,django_prices,django_prices_openexchangerates,django_prices_vatlayer,draftjs_sanitizer,faker,freezegun,geolite2,google,google_measurement_protocol,graphene,graphene_django,graphene_federation,graphql,graphql_relay,html_to_draftjs,i18naddress,jaeger_client,jwt,kombu,lxml,markdown,measurement,mptt,oauthlib,openpyxl,opentracing,petl,phonenumber_field,phonenumbers,pkg_resources,prices,promise,pytest,pythonjsonlogger,pytimeparse,pytz,razorpay,requests,sentry_sdk,storages,stripe,templated_email,tqdm,urllib3,versatileimagefield,weasyprint
diff --git a/poetry.lock b/poetry.lock
index fa9650c804..b42913c3de 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -87,6 +87,19 @@ docs = ["furo", "sphinx", "zope.interface"]
tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface"]
tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six"]
+[[package]]
+name = "authorizenet"
+version = "1.1.3"
+description = "Authorize.Net Python SDK"
+category = "main"
+optional = false
+python-versions = "*"
+
+[package.dependencies]
+lxml = ">=4.0.0,<5.0.0"
+pyxb = "1.2.5"
+requests = ">=2.0.0,<3.0.0"
+
[[package]]
name = "babel"
version = "2.9.0"
@@ -253,11 +266,11 @@ vine = ">=5.0.0,<6.0"
[package.extras]
arangodb = ["pyArango (>=1.3.2)"]
auth = ["cryptography"]
-azureblockblob = ["azure-storage (==0.36.0)", "azure-common (==1.1.5)", "azure-storage-common (==1.1.0)"]
+azureblockblob = ["azure-storage (0.36.0)", "azure-common (1.1.5)", "azure-storage-common (1.1.0)"]
brotli = ["brotli (>=1.0.0)", "brotlipy (>=0.7.0)"]
cassandra = ["cassandra-driver (<3.21.0)"]
consul = ["python-consul"]
-cosmosdbsql = ["pydocumentdb (==2.3.2)"]
+cosmosdbsql = ["pydocumentdb (2.3.2)"]
couchbase = ["couchbase (>=3.0.0)"]
couchdb = ["pycouchdb"]
django = ["Django (>=1.11)"]
@@ -278,7 +291,7 @@ s3 = ["boto3 (>=1.9.125)"]
slmq = ["softlayer-messaging (>=1.0.3)"]
solar = ["ephem"]
sqlalchemy = ["sqlalchemy"]
-sqs = ["boto3 (>=1.9.125)", "pycurl (==7.43.0.5)"]
+sqs = ["boto3 (>=1.9.125)", "pycurl (7.43.0.5)"]
tblib = ["tblib (>=1.3.0)", "tblib (>=1.5.0)"]
yaml = ["PyYAML (>=3.10)"]
zookeeper = ["kazoo (>=1.3.1)"]
@@ -834,7 +847,7 @@ gitdb = ">=4.0.1,<5"
[[package]]
name = "google-api-core"
-version = "1.24.1"
+version = "1.25.0"
description = "Google API client core library"
category = "main"
optional = false
@@ -916,7 +929,7 @@ requests = ">=2.18.0,<3.0.0dev"
[[package]]
name = "google-crc32c"
-version = "1.1.0"
+version = "1.1.1"
description = "A python wrapper of the C library 'Google CRC32C'"
category = "main"
optional = false
@@ -1019,7 +1032,7 @@ six = ">=1.10.0"
unidecode = ">=1.1.1,<2"
[package.extras]
-dev = ["black (==19.10b0)", "flake8 (==3.7.9)", "flake8-black (==0.1.1)", "flake8-bugbear (==20.1.4)", "pytest (>=3.6.3)", "pytest-cov", "coveralls", "mock", "pytz", "pytest-django (>=3.3.2)", "djangorestframework (>=3.6.3)", "django-filter (<2)", "django-filter (>=2)"]
+dev = ["black (19.10b0)", "flake8 (3.7.9)", "flake8-black (0.1.1)", "flake8-bugbear (20.1.4)", "pytest (>=3.6.3)", "pytest-cov", "coveralls", "mock", "pytz", "pytest-django (>=3.3.2)", "djangorestframework (>=3.6.3)", "django-filter (<2)", "django-filter (>=2)"]
rest_framework = ["djangorestframework (>=3.6.3)"]
test = ["pytest (>=3.6.3)", "pytest-cov", "coveralls", "mock", "pytz", "pytest-django (>=3.3.2)", "djangorestframework (>=3.6.3)", "django-filter (<2)", "django-filter (>=2)"]
@@ -1049,7 +1062,7 @@ six = ">=1.10.0"
[package.extras]
gevent = ["gevent (>=1.1)"]
-test = ["six (==1.14.0)", "pyannotate (==1.2.0)", "pytest (==4.6.10)", "pytest-django (==3.9.0)", "pytest-cov (==2.8.1)", "coveralls (==1.11.1)", "cython (==0.29.17)", "gevent (==1.5.0)", "pytest-benchmark (==3.2.3)", "pytest-mock (==2.0.0)"]
+test = ["six (1.14.0)", "pyannotate (1.2.0)", "pytest (4.6.10)", "pytest-django (3.9.0)", "pytest-cov (2.8.1)", "coveralls (1.11.1)", "cython (0.29.17)", "gevent (1.5.0)", "pytest-benchmark (3.2.3)", "pytest-mock (2.0.0)"]
[[package]]
name = "graphql-relay"
@@ -1078,7 +1091,7 @@ grpcio = ">=1.0.0,<2.0.0dev"
[[package]]
name = "grpcio"
-version = "1.34.0"
+version = "1.34.1"
description = "HTTP/2-based RPC framework"
category = "main"
optional = false
@@ -1088,7 +1101,7 @@ python-versions = "*"
six = ">=1.5.2"
[package.extras]
-protobuf = ["grpcio-tools (>=1.34.0)"]
+protobuf = ["grpcio-tools (>=1.34.1)"]
[[package]]
name = "gunicorn"
@@ -1154,11 +1167,11 @@ optional = false
python-versions = "*"
[package.extras]
-test = ["Cython (==0.29.14)"]
+test = ["Cython (0.29.14)"]
[[package]]
name = "identify"
-version = "1.5.11"
+version = "1.5.13"
description = "File identification library for Python"
category = "dev"
optional = false
@@ -1211,7 +1224,7 @@ thrift = "*"
tornado = ">=4.3"
[package.extras]
-tests = ["mock (==1.0.1)", "pycurl (>=7.43,<8)", "pytest (>=3.7.0,<3.8.0)", "pytest-cov (==2.5.1)", "coverage (<4.4)", "pytest-timeout (==1.3.1)", "pytest-tornado", "pytest-benchmark[histogram] (>=3.0.0rc1,<3.2)", "pytest-localserver", "flake8", "flake8-quotes", "codecov", "opentracing_instrumentation (>=3,<4)", "prometheus_client (==0.3.1)", "tchannel (>=0.27)"]
+tests = ["mock (1.0.1)", "pycurl (>=7.43,<8)", "pytest (>=3.7.0,<3.8.0)", "pytest-cov (2.5.1)", "coverage (<4.4)", "pytest-timeout (1.3.1)", "pytest-tornado", "pytest-benchmark[histogram] (>=3.0.0rc1,<3.2)", "pytest-localserver", "flake8", "flake8-quotes", "codecov", "opentracing_instrumentation (>=3,<4)", "prometheus_client (0.3.1)", "tchannel (>=0.27)"]
[[package]]
name = "jdcal"
@@ -1277,7 +1290,7 @@ qpid = ["qpid-python (>=0.26)", "qpid-tools (>=0.26)"]
redis = ["redis (>=3.3.11)"]
slmq = ["softlayer-messaging (>=1.0.3)"]
sqlalchemy = ["sqlalchemy"]
-sqs = ["boto3 (>=1.4.4)", "pycurl (==7.43.0.2)"]
+sqs = ["boto3 (>=1.4.4)", "pycurl (7.43.0.2)"]
yaml = ["PyYAML (>=3.10)"]
zookeeper = ["kazoo (>=1.3.1)"]
@@ -1303,7 +1316,7 @@ typing-extensions = ">=3.7.4.2"
typing-inspect = ">=0.4.0"
[package.extras]
-dev = ["black (==20.8b1)", "codecov (>=2.1.4)", "coverage (>=4.5.4)", "fixit (==0.1.1)", "flake8 (>=3.7.8)", "hypothesis (>=4.36.0)", "hypothesmith (>=0.0.4)", "isort (==5.5.3)", "jupyter (>=1.0.0)", "nbsphinx (>=0.4.2)", "pyre-check (==0.0.41)", "sphinx-rtd-theme (>=0.4.3)", "prompt-toolkit (>=2.0.9)", "tox (>=3.18.1)"]
+dev = ["black (20.8b1)", "codecov (>=2.1.4)", "coverage (>=4.5.4)", "fixit (0.1.1)", "flake8 (>=3.7.8)", "hypothesis (>=4.36.0)", "hypothesmith (>=0.0.4)", "isort (5.5.3)", "jupyter (>=1.0.0)", "nbsphinx (>=0.4.2)", "pyre-check (0.0.41)", "sphinx-rtd-theme (>=0.4.3)", "prompt-toolkit (>=2.0.9)", "tox (>=3.18.1)"]
[[package]]
name = "lxml"
@@ -1573,7 +1586,7 @@ test = ["pytest (>=2.7.3)", "pytest-cov", "coveralls", "futures", "pytest-benchm
[[package]]
name = "prompt-toolkit"
-version = "3.0.9"
+version = "3.0.10"
description = "Library for building powerful interactive command lines in Python"
category = "main"
optional = false
@@ -1698,9 +1711,9 @@ python-versions = ">=3.6"
[package.extras]
crypto = ["cryptography (>=3.3.1,<4.0.0)"]
-dev = ["sphinx", "sphinx-rtd-theme", "zope.interface", "cryptography (>=3.3.1,<4.0.0)", "pytest (>=6.0.0,<7.0.0)", "coverage[toml] (==5.0.4)", "mypy", "pre-commit"]
+dev = ["sphinx", "sphinx-rtd-theme", "zope.interface", "cryptography (>=3.3.1,<4.0.0)", "pytest (>=6.0.0,<7.0.0)", "coverage[toml] (5.0.4)", "mypy", "pre-commit"]
docs = ["sphinx", "sphinx-rtd-theme", "zope.interface"]
-tests = ["pytest (>=6.0.0,<7.0.0)", "coverage[toml] (==5.0.4)"]
+tests = ["pytest (>=6.0.0,<7.0.0)", "coverage[toml] (5.0.4)"]
[[package]]
name = "pylint"
@@ -1807,18 +1820,18 @@ celery = ">=4.4.0"
[[package]]
name = "pytest-cov"
-version = "2.10.1"
+version = "2.11.0"
description = "Pytest plugin for measuring coverage."
category = "dev"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
[package.dependencies]
-coverage = ">=4.4"
+coverage = ">=5.2.1"
pytest = ">=4.6"
[package.extras]
-testing = ["fields", "hunter", "process-tests (==2.0.2)", "six", "pytest-xdist", "virtualenv"]
+testing = ["fields", "hunter", "process-tests (2.0.2)", "six", "pytest-xdist", "virtualenv"]
[[package]]
name = "pytest-django"
@@ -1941,7 +1954,7 @@ python-versions = ">=3.4"
[[package]]
name = "python-magic"
-version = "0.4.18"
+version = "0.4.20"
description = "File type identification using libmagic"
category = "main"
optional = false
@@ -1993,6 +2006,14 @@ category = "dev"
optional = false
python-versions = "*"
+[[package]]
+name = "pyxb"
+version = "1.2.5"
+description = "Python XML Schema Bindings"
+category = "main"
+optional = false
+python-versions = "*"
+
[[package]]
name = "pyyaml"
version = "5.3.1"
@@ -2047,11 +2068,11 @@ urllib3 = ">=1.21.1,<1.27"
[package.extras]
security = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)"]
-socks = ["PySocks (>=1.5.6,!=1.5.7)", "win-inet-pton"]
+socks = ["PySocks (>=1.5.6,<1.5.7 || >1.5.7)", "win-inet-pton"]
[[package]]
name = "rsa"
-version = "4.6"
+version = "4.7"
description = "Pure-Python RSA implementation"
category = "main"
optional = false
@@ -2070,7 +2091,7 @@ python-versions = "*"
[[package]]
name = "s3transfer"
-version = "0.3.3"
+version = "0.3.4"
description = "An Amazon S3 Transfer Manager"
category = "main"
optional = false
@@ -2342,7 +2363,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4"
[package.extras]
brotli = ["brotlipy (>=0.6.0)"]
secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "ipaddress"]
-socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"]
+socks = ["PySocks (>=1.5.6,<1.5.7 || >1.5.7,<2.0)"]
[[package]]
name = "uvicorn"
@@ -2398,7 +2419,7 @@ python-versions = ">=3.6"
[[package]]
name = "virtualenv"
-version = "20.2.2"
+version = "20.3.1"
description = "Virtual Python Environment builder"
category = "dev"
optional = false
@@ -2412,7 +2433,7 @@ six = ">=1.9.0,<2"
[package.extras]
docs = ["proselint (>=0.10.2)", "sphinx (>=3)", "sphinx-argparse (>=0.2.5)", "sphinx-rtd-theme (>=0.4.3)", "towncrier (>=19.9.0rc1)"]
-testing = ["coverage (>=4)", "coverage-enable-subprocess (>=1)", "flaky (>=3)", "pytest (>=4)", "pytest-env (>=0.6.2)", "pytest-freezegun (>=0.4.1)", "pytest-mock (>=2)", "pytest-randomly (>=1)", "pytest-timeout (>=1)", "pytest-xdist (>=1.31.0)", "packaging (>=20.0)", "xonsh (>=0.9.16)"]
+testing = ["coverage (>=4)", "coverage-enable-subprocess (>=1)", "flaky (>=3)", "pytest (>=4)", "pytest-env (>=0.6.2)", "pytest-freezegun (>=0.4.1)", "pytest-mock (>=2)", "pytest-randomly (>=1)", "pytest-timeout (>=1)", "packaging (>=20.0)", "xonsh (>=0.9.16)"]
[[package]]
name = "watchgod"
@@ -2491,7 +2512,7 @@ multidict = ">=4.0"
[metadata]
lock-version = "1.1"
python-versions = "~3.9"
-content-hash = "6a92f4489c370e2fcffe382c2124ba2f2b2ecddadbb659a4f0f35eddd6552a6b"
+content-hash = "a55fb192458e19c8ea030739b55b592f78b80441c9a13f03327f4898809b3478"
[metadata.files]
adyen = [
@@ -2529,6 +2550,9 @@ attrs = [
{file = "attrs-20.3.0-py2.py3-none-any.whl", hash = "sha256:31b2eced602aa8423c2aea9c76a724617ed67cf9513173fd3a4f03e3a929c7e6"},
{file = "attrs-20.3.0.tar.gz", hash = "sha256:832aa3cde19744e49938b91fea06d69ecb9e649c93ba974535d08ad92164f700"},
]
+authorizenet = [
+ {file = "authorizenet-1.1.3.tar.gz", hash = "sha256:3d7e6f98a994ff86d6b1df83a21d3b05b57216459675e9dd88e6582a91c9ed33"},
+]
babel = [
{file = "Babel-2.9.0-py2.py3-none-any.whl", hash = "sha256:9d35c22fcc79893c3ecc85ac4a56cde1ecf3f19c540bba0922308a6c06ca6fa5"},
{file = "Babel-2.9.0.tar.gz", hash = "sha256:da031ab54472314f210b0adcff1588ee5d1d1d0ba4dbd07b94dba82bde791e05"},
@@ -2602,13 +2626,11 @@ cffi = [
{file = "cffi-1.14.4-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:a7711edca4dcef1a75257b50a2fbfe92a65187c47dab5a0f1b9b332c5919a3fb"},
{file = "cffi-1.14.4-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:00e28066507bfc3fe865a31f325c8391a1ac2916219340f87dfad602c3e48e5d"},
{file = "cffi-1.14.4-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:798caa2a2384b1cbe8a2a139d80734c9db54f9cc155c99d7cc92441a23871c03"},
- {file = "cffi-1.14.4-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:a5ed8c05548b54b998b9498753fb9cadbfd92ee88e884641377d8a8b291bcc01"},
{file = "cffi-1.14.4-cp37-cp37m-win32.whl", hash = "sha256:00a1ba5e2e95684448de9b89888ccd02c98d512064b4cb987d48f4b40aa0421e"},
{file = "cffi-1.14.4-cp37-cp37m-win_amd64.whl", hash = "sha256:9cc46bc107224ff5b6d04369e7c595acb700c3613ad7bcf2e2012f62ece80c35"},
{file = "cffi-1.14.4-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:df5169c4396adc04f9b0a05f13c074df878b6052430e03f50e68adf3a57aa28d"},
{file = "cffi-1.14.4-cp38-cp38-manylinux1_i686.whl", hash = "sha256:9ffb888f19d54a4d4dfd4b3f29bc2c16aa4972f1c2ab9c4ab09b8ab8685b9c2b"},
{file = "cffi-1.14.4-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:8d6603078baf4e11edc4168a514c5ce5b3ba6e3e9c374298cb88437957960a53"},
- {file = "cffi-1.14.4-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:d5ff0621c88ce83a28a10d2ce719b2ee85635e85c515f12bac99a95306da4b2e"},
{file = "cffi-1.14.4-cp38-cp38-win32.whl", hash = "sha256:b4e248d1087abf9f4c10f3c398896c87ce82a9856494a7155823eb45a892395d"},
{file = "cffi-1.14.4-cp38-cp38-win_amd64.whl", hash = "sha256:ec80dc47f54e6e9a78181ce05feb71a0353854cc26999db963695f950b5fb375"},
{file = "cffi-1.14.4-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:840793c68105fe031f34d6a086eaea153a0cd5c491cde82a74b420edd0a2b909"},
@@ -2648,7 +2670,6 @@ codecov = [
]
colorama = [
{file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"},
- {file = "colorama-0.4.4.tar.gz", hash = "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"},
]
coverage = [
{file = "coverage-5.3.1-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:fabeeb121735d47d8eab8671b6b031ce08514c86b7ad8f7d5490a7b6dcd6267d"},
@@ -2846,8 +2867,8 @@ gitpython = [
{file = "GitPython-3.1.12.tar.gz", hash = "sha256:42dbefd8d9e2576c496ed0059f3103dcef7125b9ce16f9d5f9c834aed44a1dac"},
]
google-api-core = [
- {file = "google-api-core-1.24.1.tar.gz", hash = "sha256:0f1dee446db2685863c3c493a90fefa5fc7f4defaf8e1a320b50ccaddfb5d469"},
- {file = "google_api_core-1.24.1-py2.py3-none-any.whl", hash = "sha256:a7f5794446a22ff7d36764959ba5f319f37628faf4da04fdc0dedf1598b556c1"},
+ {file = "google-api-core-1.25.0.tar.gz", hash = "sha256:d967beae8d8acdb88fb2f6f769e2ee0ee813042576a08891bded3b8e234150ae"},
+ {file = "google_api_core-1.25.0-py2.py3-none-any.whl", hash = "sha256:4656345cba9627ab1290eab51300a6397cc50370d99366133df1ae64b744e1eb"},
]
google-auth = [
{file = "google-auth-1.24.0.tar.gz", hash = "sha256:0b0e026b412a0ad096e753907559e4bdb180d9ba9f68dd9036164db4fdc4ad2e"},
@@ -2866,22 +2887,27 @@ google-cloud-storage = [
{file = "google_cloud_storage-1.35.0-py2.py3-none-any.whl", hash = "sha256:7b48b74683dafec5da315c7b0861ab168c208e04c763aa5db7ea8d7ecd8b6c5d"},
]
google-crc32c = [
- {file = "google-crc32c-1.1.0.tar.gz", hash = "sha256:6a6f3a365de5f433e41602b73df21306f67f02f15fdd2750961ae7d4a4629863"},
- {file = "google_crc32c-1.1.0-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:e9be2ccfc510fc84a7de875d8f8e59d70818c819fbd0f74ff0a8aa4a1c057f94"},
- {file = "google_crc32c-1.1.0-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:ebc3c794d9f96d0fbb5177984e12206d3d7371762f67782cfd150e32722b8aed"},
- {file = "google_crc32c-1.1.0-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:4a9ab614ec85d0977af76a093cab514ce78ec20ba3cecd3af4715a111a5ec250"},
- {file = "google_crc32c-1.1.0-cp36-cp36m-win32.whl", hash = "sha256:bb1d7efb881406963dd919fbc3db4f248a5aa0c600295b2a65ea68d4ca79032a"},
- {file = "google_crc32c-1.1.0-cp36-cp36m-win_amd64.whl", hash = "sha256:e25e8cf79d1daf05dae69bf4dd1b73f2ee34674f4ea44176ed3cd764f206cc9d"},
- {file = "google_crc32c-1.1.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:e5cc963e4c76f1c85a4b5045f86fdbb501c1ff0579a3d40431eac2137508af68"},
- {file = "google_crc32c-1.1.0-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:f050433604b55ff7efbca099d0b806dcbbf5fc1eec2a2640eb61ca0e44aaed5b"},
- {file = "google_crc32c-1.1.0-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:279f38be88b274872d9c9ef8d0479a0bc3279e5b7faebea45a86501d18000242"},
- {file = "google_crc32c-1.1.0-cp37-cp37m-win32.whl", hash = "sha256:d0cede9482ec2c3cc3c1b8fa11c10f1ac4760e1dbd8efdb5e39f93420ca75bec"},
- {file = "google_crc32c-1.1.0-cp37-cp37m-win_amd64.whl", hash = "sha256:28e0712ddb73ba02e5a4f03d571a864e8a1e64941e394a8ace1118128903c73b"},
- {file = "google_crc32c-1.1.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:ade6f03d3670bec8ccc1b9a6ca7123985c14e83923ecba2b88dedd3f88e795e5"},
- {file = "google_crc32c-1.1.0-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:55e44136e0a23de7f31207644d5765c1c55402f7b23bf1a6625317f4d50c8725"},
- {file = "google_crc32c-1.1.0-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:9ad95a167f7bf8e27992677b5b1e411eaadf0ffa81961fa203d88b2be5394618"},
- {file = "google_crc32c-1.1.0-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:6385d87cd15a7c9f7ff63b08f6d01c8665053ad69f1ac80054cf7a94a7139bfc"},
- {file = "google_crc32c-1.1.0-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:82b4ce1c515a455f21e4f6aea8d45252e2b319fa604b8d9f2cb301d5a752f578"},
+ {file = "google-crc32c-1.1.1.tar.gz", hash = "sha256:d585f5d962812354a6113f962d06d67c4177993d8ed1b99e3fbb9753b1b98d65"},
+ {file = "google_crc32c-1.1.1-cp36-cp36m-macosx_10_14_x86_64.whl", hash = "sha256:703d3f2fe4426f403ac8eb1229bbf458780df795bd4fdb04b0b73400dd58c108"},
+ {file = "google_crc32c-1.1.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:75a43a19a6df9366d4ce6c171ab46ea60a0995eedf3ab988c111796e02e8e5ce"},
+ {file = "google_crc32c-1.1.1-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:38d8808446fd38c7084a7b21bfc0aa22cd97eda320f3a391f524390de84377f8"},
+ {file = "google_crc32c-1.1.1-cp36-cp36m-win32.whl", hash = "sha256:4c5f7c9a2d500ca4b6142708832439410fb2b1422b5cebbad7f455bc0c40753b"},
+ {file = "google_crc32c-1.1.1-cp36-cp36m-win_amd64.whl", hash = "sha256:3060d2e0d415a15de5189c2f6f521723c69f45633f8b4a62db8402c456b583bc"},
+ {file = "google_crc32c-1.1.1-cp37-cp37m-macosx_10_14_x86_64.whl", hash = "sha256:2c4d71f5212f039de575c3ec17ee5b2c14f293ec9f95ce7d054194aa55499405"},
+ {file = "google_crc32c-1.1.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:46654a852cea70d0a5ccbfb078bdadca43c01448e96f301e5677d3bd4a0a808d"},
+ {file = "google_crc32c-1.1.1-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:be277a1861ffef89cf68f34a1acb63173811df9f7e4d3f136a6ff2f578d1f54d"},
+ {file = "google_crc32c-1.1.1-cp37-cp37m-win32.whl", hash = "sha256:df5bccf9f38e72c77c607f27781f3e0c5cf77a1938020829872eb167f295c744"},
+ {file = "google_crc32c-1.1.1-cp37-cp37m-win_amd64.whl", hash = "sha256:2071754849915d070d6eb04a6522e05a1ecf2a58e55230c50367e183d6dc825b"},
+ {file = "google_crc32c-1.1.1-cp38-cp38-macosx_10_14_x86_64.whl", hash = "sha256:8875822807ab288b8034ba29a2d9b927036e31455b20e4831473e4f3d8b3f01c"},
+ {file = "google_crc32c-1.1.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:783278dbe80c79637bfff011a2a61e02d268fdb38766be5bf1c56c43076c881a"},
+ {file = "google_crc32c-1.1.1-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:5a92ce8dd5dd27d3386dfb2a53fd272814f03e2f41b6e941061345fc36954f54"},
+ {file = "google_crc32c-1.1.1-cp38-cp38-win32.whl", hash = "sha256:e10342adc665c0d22d76ea0d044cf588a96dfbea56b564a82d9ec5ae0634c848"},
+ {file = "google_crc32c-1.1.1-cp38-cp38-win_amd64.whl", hash = "sha256:c981f2fc2dc50a400cca9c0536ffe9080f8c713908633617007530ddf302eec8"},
+ {file = "google_crc32c-1.1.1-cp39-cp39-macosx_10_14_x86_64.whl", hash = "sha256:94e65d56383f234b1f39dffc3a5647769918e4f13d49db11df7b176035781a39"},
+ {file = "google_crc32c-1.1.1-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:1aed1db85b5862b969e93e9fef80e9c61d989447d52ea236f9f76af76dd84a51"},
+ {file = "google_crc32c-1.1.1-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:a9d784f37637b992447a80d4312a10f948400e4cd7a626f22d23131238cda722"},
+ {file = "google_crc32c-1.1.1-cp39-cp39-win32.whl", hash = "sha256:15f6d38bfc860463169b142da327a2e875266d4c0db83a3ec8e6366364ac9dd7"},
+ {file = "google_crc32c-1.1.1-cp39-cp39-win_amd64.whl", hash = "sha256:c83720353c57a5a800b51d3118e0297b00ede1413a9b49a0f75e61c96ee91e98"},
]
google-i18n-address = [
{file = "google-i18n-address-2.4.0.tar.gz", hash = "sha256:8454a58f254a29988b8d1ca9ab663fd28a1f392a3d29b844d8824807db6333d7"},
@@ -2922,52 +2948,52 @@ grpc-google-iam-v1 = [
{file = "grpc-google-iam-v1-0.12.3.tar.gz", hash = "sha256:0bfb5b56f648f457021a91c0df0db4934b6e0c300bd0f2de2333383fe958aa72"},
]
grpcio = [
- {file = "grpcio-1.34.0-cp27-cp27m-macosx_10_10_x86_64.whl", hash = "sha256:e2ffa46db9103706640c74886ac23ed18d1487a8523cc128da239e1d5a4e3301"},
- {file = "grpcio-1.34.0-cp27-cp27m-manylinux2010_i686.whl", hash = "sha256:843436e69c37eb45b0285fa42f7acc06d147f2e9c1d515b0f901e94d40107e79"},
- {file = "grpcio-1.34.0-cp27-cp27m-manylinux2010_x86_64.whl", hash = "sha256:a403ed4d8fcc441a2c2ec9ede838b0ae5f9da996d950cf2ff9f82242b496e0a7"},
- {file = "grpcio-1.34.0-cp27-cp27m-win32.whl", hash = "sha256:dc45f5750ce50f34f20a0607efae5c797d01681a44465b8287bebef1e9847d5b"},
- {file = "grpcio-1.34.0-cp27-cp27m-win_amd64.whl", hash = "sha256:2fd4a80f267aa258f5a74df5fe243eff80299a4f5b356c1da53f6f5793bbbf4b"},
- {file = "grpcio-1.34.0-cp27-cp27mu-linux_armv7l.whl", hash = "sha256:f2e4d64675351a058f9cb35fe390ca0956bd2926171bfb7c87596a1ee10ff6ba"},
- {file = "grpcio-1.34.0-cp27-cp27mu-manylinux2010_i686.whl", hash = "sha256:4a2c85cd4a67c36fe12535fe32eb336635843d1eb31d3fa301444e60a8df9c90"},
- {file = "grpcio-1.34.0-cp27-cp27mu-manylinux2010_x86_64.whl", hash = "sha256:32ad56f6d3d7e699f9a0d62719f2de9092e79f444d875d70f58cf7f8bb19684c"},
- {file = "grpcio-1.34.0-cp35-cp35m-linux_armv7l.whl", hash = "sha256:e69ac6fc9096bbb43f5276655661db746233cd320808e0d302198eb43dc7bd04"},
- {file = "grpcio-1.34.0-cp35-cp35m-macosx_10_10_intel.whl", hash = "sha256:5b105adb44486fb594b8d8142b5d4fbe50cb125c77ac7d270f5d0277ce5c554a"},
- {file = "grpcio-1.34.0-cp35-cp35m-manylinux2010_i686.whl", hash = "sha256:923a3b18badc3749c4d715216934f62f46a818790e325ece6184d07e7d6c7f73"},
- {file = "grpcio-1.34.0-cp35-cp35m-manylinux2010_x86_64.whl", hash = "sha256:9579f22222ac89ceee64c1101cced6434d9f6b12078b43ece0f9d8ebdb657f73"},
- {file = "grpcio-1.34.0-cp35-cp35m-manylinux2014_i686.whl", hash = "sha256:dfa098a6ff8d1b68ed7bd655150ee91f57c29042c093ff51113176aded3f0071"},
- {file = "grpcio-1.34.0-cp35-cp35m-manylinux2014_x86_64.whl", hash = "sha256:32fbc78d558d9468a4b16f79f4130daec8e431bc7a3b1775b0e98f09a7ab45a2"},
- {file = "grpcio-1.34.0-cp35-cp35m-win32.whl", hash = "sha256:205eda06d8aeffc87a1e29ff1f090546adf0b6e766378cc4c13686534397fdb4"},
- {file = "grpcio-1.34.0-cp35-cp35m-win_amd64.whl", hash = "sha256:2ea864ae3d3abc99d3988d1d27dee3f6350b60149ccf810a89cd9a9d02a675d6"},
- {file = "grpcio-1.34.0-cp36-cp36m-linux_armv7l.whl", hash = "sha256:5d8108b240fd5b8a0483f95ab2651fe2d633311faae93a12938ea06cf61a5efd"},
- {file = "grpcio-1.34.0-cp36-cp36m-macosx_10_10_x86_64.whl", hash = "sha256:bda0f52eb1279a7119526df2ef33ea2808691120daf9effaf60ca0c07f76058a"},
- {file = "grpcio-1.34.0-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:c89b6a3eca8eae10eea78896ccfdc9d04aa2f7b2ee96de20246e5c96494c68f5"},
- {file = "grpcio-1.34.0-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:fa834f4c70b9df83d5af610097747c224513d59af1f03e8c06bca9a7d81fd1a3"},
- {file = "grpcio-1.34.0-cp36-cp36m-manylinux2014_i686.whl", hash = "sha256:20606ec7c265f81c5a0226f69842dc8dde66d921968ab9448e59d440cf98bebf"},
- {file = "grpcio-1.34.0-cp36-cp36m-manylinux2014_x86_64.whl", hash = "sha256:72b6a89aabf937d706946230f5aa13bdf7d2a42874810fa54436c647577b543e"},
- {file = "grpcio-1.34.0-cp36-cp36m-win32.whl", hash = "sha256:49da07ae43c552280b8b4c70617f9b589588404c2545d6eba2c55179b3d836af"},
- {file = "grpcio-1.34.0-cp36-cp36m-win_amd64.whl", hash = "sha256:beef6be49ada569edf3b73fd4eb57d6c2af7e10c0c82a210dbe51de7c4a1ed53"},
- {file = "grpcio-1.34.0-cp37-cp37m-macosx_10_10_x86_64.whl", hash = "sha256:8d92e884f6d67b9a2a4514631d3c9836281044caedb5fd34d4ce2bbec138c87d"},
- {file = "grpcio-1.34.0-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:e238a554f29d90b0e7fca15e8119b9a7c5f88faacbf9b982751ad54d639b57f8"},
- {file = "grpcio-1.34.0-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:98b0b6e44c451093354a38b620e6e0df958b0710abd6a0ddd84da84424bce003"},
- {file = "grpcio-1.34.0-cp37-cp37m-manylinux2014_i686.whl", hash = "sha256:bbd3522f821fb5d01049db214fb9f949a8b2d92761c2780a20ff73818efd5360"},
- {file = "grpcio-1.34.0-cp37-cp37m-manylinux2014_x86_64.whl", hash = "sha256:2f54046ca2a81ff45ec8f6d3d7447ad562adb067c3640c35354e440fd771b625"},
- {file = "grpcio-1.34.0-cp37-cp37m-win32.whl", hash = "sha256:50c4f10e7deff96d197bc6d1988c2a5a0bc6252bbd31d7fb374ce8923f937e7a"},
- {file = "grpcio-1.34.0-cp37-cp37m-win_amd64.whl", hash = "sha256:6fafdba42c26bbdf78948c09a93a8b3a8a509c66c6b4324bc1fb360bf4e82b9d"},
- {file = "grpcio-1.34.0-cp38-cp38-macosx_10_10_x86_64.whl", hash = "sha256:bd7634f8c49c8467fec5fd9e0d1abb205b0aa61670ff0113ef835ca6548aad3d"},
- {file = "grpcio-1.34.0-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:69127393fc3513da228bc3908914df2284923e0eacf8d73f21ad387317450317"},
- {file = "grpcio-1.34.0-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:5e8e6035d4f9ab856ab437e381e652b31dfd42443d2243d45bdf4b90adaf3559"},
- {file = "grpcio-1.34.0-cp38-cp38-manylinux2014_i686.whl", hash = "sha256:95de4ad9ae39590668e3330d414253f672aedd46cc107d7f71b4a2268f3d6066"},
- {file = "grpcio-1.34.0-cp38-cp38-manylinux2014_x86_64.whl", hash = "sha256:a1024006fe61ee7e43e7099faf08f4508ea0c944a1558e8d715a5b4556937ace"},
- {file = "grpcio-1.34.0-cp38-cp38-win32.whl", hash = "sha256:dea35dcf09aee91552cb4b3e250efdbcb79564b5b5517246bcbead8d5871e291"},
- {file = "grpcio-1.34.0-cp38-cp38-win_amd64.whl", hash = "sha256:e95bda60c584b3deb5c37babb44d4300cf4bf3a6c43198a244ddcaddca3fde3a"},
- {file = "grpcio-1.34.0-cp39-cp39-macosx_10_10_x86_64.whl", hash = "sha256:c88ce184973fe2035ffa176eb08cd492db090505e6b1ddc68b5cc1e0b01a07a0"},
- {file = "grpcio-1.34.0-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:57a30f9df0f5342e4dad384e7023b9f88742c325838da977828c37f49eb8940a"},
- {file = "grpcio-1.34.0-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:924d5e8b18942ebea1260e60be7e2bde2a3587ea386190b442790f84180bf372"},
- {file = "grpcio-1.34.0-cp39-cp39-manylinux2014_i686.whl", hash = "sha256:43fafebcc2e81d012f7147a0ddf9be69864c40fc4edd9844937eba0020508297"},
- {file = "grpcio-1.34.0-cp39-cp39-manylinux2014_x86_64.whl", hash = "sha256:9550b7c9d2f11579b484accc6183e02ebe33ce80a0ff15f5c28895df6b3d3108"},
- {file = "grpcio-1.34.0-cp39-cp39-win32.whl", hash = "sha256:d16f7f5a10bf24640fa639974d409c220e587b3e2fa2620af00d43ba36dafc2c"},
- {file = "grpcio-1.34.0-cp39-cp39-win_amd64.whl", hash = "sha256:25958bd7c6773e6de79781cc0d6f19d0c82332984dd07ef238889e93485d5afc"},
- {file = "grpcio-1.34.0.tar.gz", hash = "sha256:f98f746cacbaa681de0bcd90d7aa77b440e3e1327a9988f6a2b580d54e27d4c3"},
+ {file = "grpcio-1.34.1-cp27-cp27m-macosx_10_10_x86_64.whl", hash = "sha256:5c4402fd8ce28e2847112105591139dc121c8980770f683eb781be1568a64097"},
+ {file = "grpcio-1.34.1-cp27-cp27m-manylinux2010_i686.whl", hash = "sha256:c6f756c11144c7ecb51b87f0d60a4b72e05635b9f24ddfa004286ab0c8527fa0"},
+ {file = "grpcio-1.34.1-cp27-cp27m-manylinux2010_x86_64.whl", hash = "sha256:ec6d1b3daed886a73e40b4dc553474ef415acc111e913d7324cc2c6b0ba9efe0"},
+ {file = "grpcio-1.34.1-cp27-cp27m-win32.whl", hash = "sha256:d757bc8bb12f07014dde55a04b5261c94828b605cf0726d02d491c3dc71aa6bb"},
+ {file = "grpcio-1.34.1-cp27-cp27m-win_amd64.whl", hash = "sha256:f74cb93cd090b07528cf586a18628370e5780c08e0239f4af796f60a5e773568"},
+ {file = "grpcio-1.34.1-cp27-cp27mu-linux_armv7l.whl", hash = "sha256:c4355fa382dfc71c130dc3eccd8ae606a13e1729be2a77b6c44cd5a130d0c616"},
+ {file = "grpcio-1.34.1-cp27-cp27mu-manylinux2010_i686.whl", hash = "sha256:f1a8048428a7a1e5b12322b3ee44ee0bb8e1bea1d67f08fa1813c455f3ef638c"},
+ {file = "grpcio-1.34.1-cp27-cp27mu-manylinux2010_x86_64.whl", hash = "sha256:0bd906496b9dd3751b9e5cacc7ceb25a57c16ce2aa67315b85ee86a4ba7246f1"},
+ {file = "grpcio-1.34.1-cp35-cp35m-linux_armv7l.whl", hash = "sha256:5e488a40ebeb883117aa0dba2cea410ef2ab545a2403b2ac9101e62d42808c71"},
+ {file = "grpcio-1.34.1-cp35-cp35m-macosx_10_10_intel.whl", hash = "sha256:98c06f0f7feeca736cc98f3f46b9b74c5f5fdc5febfc7d72728d1895c57be87f"},
+ {file = "grpcio-1.34.1-cp35-cp35m-manylinux2010_i686.whl", hash = "sha256:90a4799c15b8b5aa587f65650a0cea28ea88bcd2c5fdf4f1adb2b8b7b4e77a5e"},
+ {file = "grpcio-1.34.1-cp35-cp35m-manylinux2010_x86_64.whl", hash = "sha256:121af89d0b9ba1d47c738242783675009dd4e9067359481e4b743eb9e5886682"},
+ {file = "grpcio-1.34.1-cp35-cp35m-manylinux2014_i686.whl", hash = "sha256:1be193803c706f78d0df12c817eaf2415fb4d39472fa00d860700e6c7a99f8f7"},
+ {file = "grpcio-1.34.1-cp35-cp35m-manylinux2014_x86_64.whl", hash = "sha256:9e465a1d594a9a5f4252c4abbb93909c42768bee5fbfcd18098d60bf06a35573"},
+ {file = "grpcio-1.34.1-cp35-cp35m-win32.whl", hash = "sha256:8b16d14160b7fd8bc43600be70e0da677d17dd8aafb5a258bbda996fe410320e"},
+ {file = "grpcio-1.34.1-cp35-cp35m-win_amd64.whl", hash = "sha256:8a543209ab606dd55c58dc218be8e8619214607f03717dded78c7d27f1d05ba5"},
+ {file = "grpcio-1.34.1-cp36-cp36m-linux_armv7l.whl", hash = "sha256:f74f270550df347a18f839331f84838b938c8923a9e13a6fa7cc69c79087a686"},
+ {file = "grpcio-1.34.1-cp36-cp36m-macosx_10_10_x86_64.whl", hash = "sha256:163a2cf7f4df3ff0a04f49e634526e3d88f02393a7ebf8f34a2134c88b06322e"},
+ {file = "grpcio-1.34.1-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:11735ac4efd53691afeb36d006e20db9b7d4b6f3356c751f32d5747aee38fa4c"},
+ {file = "grpcio-1.34.1-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:79bda20756e2fc7236b94468ffcce4b516953f946a80b7ea883f89d9e9b25a41"},
+ {file = "grpcio-1.34.1-cp36-cp36m-manylinux2014_i686.whl", hash = "sha256:1857f88b351e2382aa57ed892960361a8b71acca4aa1b90998007b4177f15114"},
+ {file = "grpcio-1.34.1-cp36-cp36m-manylinux2014_x86_64.whl", hash = "sha256:6f81fbf9f830e20aee93480305877f73f15bfa58fa87433eb331696be47ae7ba"},
+ {file = "grpcio-1.34.1-cp36-cp36m-win32.whl", hash = "sha256:ff8aef869c2e9de65c3a693406f7d1200d87e6d541d096eae69f98e7f301fa60"},
+ {file = "grpcio-1.34.1-cp36-cp36m-win_amd64.whl", hash = "sha256:ece7459c182e00ca90b2e5823940a552651b5eb3acdeee9350377ddb44d9c412"},
+ {file = "grpcio-1.34.1-cp37-cp37m-macosx_10_10_x86_64.whl", hash = "sha256:7924ef3a898f6ff985540ee5d8c7554f0c925dc7668c3d63461600ea50b39658"},
+ {file = "grpcio-1.34.1-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:b5e96ca83d5c34c9b60d8951e52492b0d9d072c3fe38a1c19765932e121036ce"},
+ {file = "grpcio-1.34.1-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:fe9360347a3f4f2ec6923d8afb03a9194f3f14e054cb09e75e8346af9c0aa9f6"},
+ {file = "grpcio-1.34.1-cp37-cp37m-manylinux2014_i686.whl", hash = "sha256:cadc09c9bd24ecf3ba7ae55b5a741f7de694a8843e97e82a7c3fa2e6e81e0f9a"},
+ {file = "grpcio-1.34.1-cp37-cp37m-manylinux2014_x86_64.whl", hash = "sha256:5971e6dfcfa0ebeb0df2d15383e1b53fa36208198c8aff9a4eed5ece2a6d4571"},
+ {file = "grpcio-1.34.1-cp37-cp37m-win32.whl", hash = "sha256:a181092b534e996e36d0c0216d81280d4942322170c823b2fb84ec4597dc0bd5"},
+ {file = "grpcio-1.34.1-cp37-cp37m-win_amd64.whl", hash = "sha256:2b97cdd4582445ad7bd441f5f3c57d838bcdc518a05713dab0c7f4b945afb39e"},
+ {file = "grpcio-1.34.1-cp38-cp38-macosx_10_10_x86_64.whl", hash = "sha256:ff760c5ce73c177851864e8caaf75467eaf06c1b6857b21e1789658375e720fb"},
+ {file = "grpcio-1.34.1-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:fd58ea88dd5439e03c6587f0b672db1627ec8ed47be312c74632650dfed33c2e"},
+ {file = "grpcio-1.34.1-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:f6fee4445cffb45593b4c1d9bb0bc7922e77ec846a1237e2e744b1223d69c863"},
+ {file = "grpcio-1.34.1-cp38-cp38-manylinux2014_i686.whl", hash = "sha256:cd4da71e105088b1a7e629d1b033f16d87dec08524d0e4f5d77982af6fe1b6c2"},
+ {file = "grpcio-1.34.1-cp38-cp38-manylinux2014_x86_64.whl", hash = "sha256:9d43849d8925ec24bf121bccd941a13d4e8c2cffdfa769a04a6d4ed38c6b88a2"},
+ {file = "grpcio-1.34.1-cp38-cp38-win32.whl", hash = "sha256:696f0de4d47f738063432bbbcecd07f78256864f0839e41369458421f539f00a"},
+ {file = "grpcio-1.34.1-cp38-cp38-win_amd64.whl", hash = "sha256:8fff784ec5d12252a7cc0ab6f1a3206861b94e45ee0ebeba2439bd10a6db2f1a"},
+ {file = "grpcio-1.34.1-cp39-cp39-macosx_10_10_x86_64.whl", hash = "sha256:ed8ac4f76cbbef5dc54594cb7bf6fbb985f5be66abcb1f9da8142500e4d76492"},
+ {file = "grpcio-1.34.1-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:8dad4184e4669672e126de26776eba8e3db4914660b4a0a6c7edbdbcf3e2f05f"},
+ {file = "grpcio-1.34.1-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:011e9b5e47cb9d2a808e8c2dd5ae86df085d5879d9e8095a24631a32c577f231"},
+ {file = "grpcio-1.34.1-cp39-cp39-manylinux2014_i686.whl", hash = "sha256:49ffc5bb78b201db24d8d1644193beb50a896c3cb35b259b4fb9c44dba18585f"},
+ {file = "grpcio-1.34.1-cp39-cp39-manylinux2014_x86_64.whl", hash = "sha256:cfe0e015cb8db5a27a92621fdd9dc8e69b2f7130db326601802e6ff36626deff"},
+ {file = "grpcio-1.34.1-cp39-cp39-win32.whl", hash = "sha256:809732f300fa8093b40f843c36f6f78423ffb40493098185bc4a96bd67126db5"},
+ {file = "grpcio-1.34.1-cp39-cp39-win_amd64.whl", hash = "sha256:96dc85c059f15390beb7ac6bf075d1e4cf72e8f5c9b6c37ea179b7cc579816fd"},
+ {file = "grpcio-1.34.1.tar.gz", hash = "sha256:1c746a3cd8a830d8d916a9d0476a786aaa98c5cc2a096344af2be955e439f8ac"},
]
gunicorn = [
{file = "gunicorn-20.0.4-py2.py3-none-any.whl", hash = "sha256:cd4a810dd51bf497552cf3f863b575dabd73d6ad6a91075b65936b151cbf4f9c"},
@@ -2999,8 +3025,8 @@ httptools = [
{file = "httptools-0.1.1.tar.gz", hash = "sha256:41b573cf33f64a8f8f3400d0a7faf48e1888582b6f6e02b82b9bd4f0bf7497ce"},
]
identify = [
- {file = "identify-1.5.11-py2.py3-none-any.whl", hash = "sha256:7aef7a5104d6254c162990e54a203cdc0fd202046b6c415bd5d636472f6565c4"},
- {file = "identify-1.5.11.tar.gz", hash = "sha256:b2c71bf9f5c482c389cef816f3a15f1c9d7429ad70f497d4a2e522442d80c6de"},
+ {file = "identify-1.5.13-py2.py3-none-any.whl", hash = "sha256:9dfb63a2e871b807e3ba62f029813552a24b5289504f5b071dea9b041aee9fe4"},
+ {file = "identify-1.5.13.tar.gz", hash = "sha256:70b638cf4743f33042bebb3b51e25261a0a10e80f978739f17e7fd4837664a66"},
]
idna = [
{file = "idna-2.10-py2.py3-none-any.whl", hash = "sha256:b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0"},
@@ -3297,8 +3323,8 @@ promise = [
{file = "promise-2.3.tar.gz", hash = "sha256:dfd18337c523ba4b6a58801c164c1904a9d4d1b1747c7d5dbf45b693a49d93d0"},
]
prompt-toolkit = [
- {file = "prompt_toolkit-3.0.9-py3-none-any.whl", hash = "sha256:45b154489d89dc41cce86a069a65f3886206518e7ca93fa9d7dad70546c78d54"},
- {file = "prompt_toolkit-3.0.9.tar.gz", hash = "sha256:c5eeab58dd31b541442825d7870777f2a2f764eb5fda03334d5219cd84b9722f"},
+ {file = "prompt_toolkit-3.0.10-py3-none-any.whl", hash = "sha256:ac329c69bd8564cb491940511957312c7b8959bb5b3cf3582b406068a51d5bb7"},
+ {file = "prompt_toolkit-3.0.10.tar.gz", hash = "sha256:b8b3d0bde65da350290c46a8f54f336b3cbf5464a4ac11239668d986852e79d5"},
]
proto-plus = [
{file = "proto-plus-1.13.0.tar.gz", hash = "sha256:61b57c5257ca583af2ea1ad40e2b8f251988806eea9f01d119088976b995b2c4"},
@@ -3354,11 +3380,8 @@ psycopg2-binary = [
{file = "psycopg2_binary-2.8.6-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:2dac98e85565d5688e8ab7bdea5446674a83a3945a8f416ad0110018d1501b94"},
{file = "psycopg2_binary-2.8.6-cp38-cp38-win32.whl", hash = "sha256:bd1be66dde2b82f80afb9459fc618216753f67109b859a361cf7def5c7968729"},
{file = "psycopg2_binary-2.8.6-cp38-cp38-win_amd64.whl", hash = "sha256:8cd0fb36c7412996859cb4606a35969dd01f4ea34d9812a141cd920c3b18be77"},
- {file = "psycopg2_binary-2.8.6-cp39-cp39-macosx_10_9_x86_64.macosx_10_9_intel.macosx_10_10_intel.macosx_10_10_x86_64.whl", hash = "sha256:89705f45ce07b2dfa806ee84439ec67c5d9a0ef20154e0e475e2b2ed392a5b83"},
{file = "psycopg2_binary-2.8.6-cp39-cp39-manylinux1_i686.whl", hash = "sha256:42ec1035841b389e8cc3692277a0bd81cdfe0b65d575a2c8862cec7a80e62e52"},
{file = "psycopg2_binary-2.8.6-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:7312e931b90fe14f925729cde58022f5d034241918a5c4f9797cac62f6b3a9dd"},
- {file = "psycopg2_binary-2.8.6-cp39-cp39-win32.whl", hash = "sha256:6422f2ff0919fd720195f64ffd8f924c1395d30f9a495f31e2392c2efafb5056"},
- {file = "psycopg2_binary-2.8.6-cp39-cp39-win_amd64.whl", hash = "sha256:15978a1fbd225583dd8cdaf37e67ccc278b5abecb4caf6b2d6b8e2b948e953f6"},
]
purl = [
{file = "purl-1.5-py2.py3-none-any.whl", hash = "sha256:5ac0e85979da0172d80156701cb3eb9b1eff31f3b43e981ef6dc06251c53a3a4"},
@@ -3450,8 +3473,8 @@ pytest-celery = [
{file = "pytest_celery-0.0.0a1-py2.py3-none-any.whl", hash = "sha256:2fa8d0ae0d573fb2ee51902bfa220e891044eafadbfb132b28b7087295c3004f"},
]
pytest-cov = [
- {file = "pytest-cov-2.10.1.tar.gz", hash = "sha256:47bd0ce14056fdd79f93e1713f88fad7bdcc583dcd7783da86ef2f085a0bb88e"},
- {file = "pytest_cov-2.10.1-py2.py3-none-any.whl", hash = "sha256:45ec2d5182f89a81fc3eb29e3d1ed3113b9e9a873bcddb2a71faaab066110191"},
+ {file = "pytest-cov-2.11.0.tar.gz", hash = "sha256:e90e034cde61dacb1394639a33f449725c591025b182d69752c1dd0bfec639a7"},
+ {file = "pytest_cov-2.11.0-py2.py3-none-any.whl", hash = "sha256:626a8a6ab188656c4f84b67d22436d6c494699d917e567e0048dda6e7f59e028"},
]
pytest-django = [
{file = "pytest-django-4.1.0.tar.gz", hash = "sha256:26f02c16d36fd4c8672390deebe3413678d89f30720c16efb8b2a6bf63b9041f"},
@@ -3488,8 +3511,8 @@ python-json-logger = [
{file = "python-json-logger-2.0.1.tar.gz", hash = "sha256:f26eea7898db40609563bed0a7ca11af12e2a79858632706d835a0f961b7d398"},
]
python-magic = [
- {file = "python-magic-0.4.18.tar.gz", hash = "sha256:b757db2a5289ea3f1ced9e60f072965243ea43a2221430048fd8cacab17be0ce"},
- {file = "python_magic-0.4.18-py2.py3-none-any.whl", hash = "sha256:356efa93c8899047d1eb7d3eb91e871ba2f5b1376edbaf4cc305e3c872207355"},
+ {file = "python-magic-0.4.20.tar.gz", hash = "sha256:0cc52ccad086c377b9194014e3dbf98d94b194344630172510a6a3e716b47801"},
+ {file = "python_magic-0.4.20-py2.py3-none-any.whl", hash = "sha256:33ce94d9395aa269a9c5fac10ae124a5fb328ebe248f36efc5a43922edee662e"},
]
python-magic-bin = [
{file = "python_magic_bin-0.4.14-py2.py3-none-macosx_10_6_intel.whl", hash = "sha256:7b1743b3dbf16601d6eedf4e7c2c9a637901b0faaf24ad4df4d4527e7d8f66a4"},
@@ -3510,6 +3533,9 @@ pytz = [
pywatchman = [
{file = "pywatchman-1.4.1.tar.gz", hash = "sha256:d0047eb275deafb0011eda0a1a815fbd9742478c3d2b5ad6956d300e447dc2f9"},
]
+pyxb = [
+ {file = "PyXB-1.2.5.tar.gz", hash = "sha256:4e8f62ee2cfffc37e4f40634ab9c79e0311cfaf28cf4ce5e7f4828ec56e4ff67"},
+]
pyyaml = [
{file = "PyYAML-5.3.1-cp27-cp27m-win32.whl", hash = "sha256:74809a57b329d6cc0fdccee6318f44b9b8649961fa73144a98735b0aaf029f1f"},
{file = "PyYAML-5.3.1-cp27-cp27m-win_amd64.whl", hash = "sha256:240097ff019d7c70a4922b6869d8a86407758333f02203e0fc6ff79c5dcede76"},
@@ -3521,8 +3547,6 @@ pyyaml = [
{file = "PyYAML-5.3.1-cp37-cp37m-win_amd64.whl", hash = "sha256:73f099454b799e05e5ab51423c7bcf361c58d3206fa7b0d555426b1f4d9a3eaf"},
{file = "PyYAML-5.3.1-cp38-cp38-win32.whl", hash = "sha256:06a0d7ba600ce0b2d2fe2e78453a470b5a6e000a985dd4a4e54e436cc36b0e97"},
{file = "PyYAML-5.3.1-cp38-cp38-win_amd64.whl", hash = "sha256:95f71d2af0ff4227885f7a6605c37fd53d3a106fcab511b8860ecca9fcf400ee"},
- {file = "PyYAML-5.3.1-cp39-cp39-win32.whl", hash = "sha256:ad9c67312c84def58f3c04504727ca879cb0013b2517c85a9a253f0cb6380c0a"},
- {file = "PyYAML-5.3.1-cp39-cp39-win_amd64.whl", hash = "sha256:6034f55dab5fea9e53f436aa68fa3ace2634918e8b5994d82f3621c04ff5ed2e"},
{file = "PyYAML-5.3.1.tar.gz", hash = "sha256:b8eac752c5e14d3eca0e6dd9199cd627518cb5ec06add0de9d32baeee6fe645d"},
]
razorpay = [
@@ -3581,16 +3605,16 @@ requests = [
{file = "requests-2.25.1.tar.gz", hash = "sha256:27973dd4a904a4f13b263a19c866c13b92a39ed1c964655f025f3f8d3d75b804"},
]
rsa = [
- {file = "rsa-4.6-py3-none-any.whl", hash = "sha256:6166864e23d6b5195a5cfed6cd9fed0fe774e226d8f854fcb23b7bbef0350233"},
- {file = "rsa-4.6.tar.gz", hash = "sha256:109ea5a66744dd859bf16fe904b8d8b627adafb9408753161e766a92e7d681fa"},
+ {file = "rsa-4.7-py3-none-any.whl", hash = "sha256:a8774e55b59fd9fc893b0d05e9bfc6f47081f46ff5b46f39ccf24631b7be356b"},
+ {file = "rsa-4.7.tar.gz", hash = "sha256:69805d6b69f56eb05b62daea3a7dbd7aa44324ad1306445e05da8060232d00f4"},
]
rx = [
{file = "Rx-1.6.1-py2.py3-none-any.whl", hash = "sha256:7357592bc7e881a95e0c2013b73326f704953301ab551fbc8133a6fadab84105"},
{file = "Rx-1.6.1.tar.gz", hash = "sha256:13a1d8d9e252625c173dc795471e614eadfe1cf40ffc684e08b8fff0d9748c23"},
]
s3transfer = [
- {file = "s3transfer-0.3.3-py2.py3-none-any.whl", hash = "sha256:2482b4259524933a022d59da830f51bd746db62f047d6eb213f2f8855dcb8a13"},
- {file = "s3transfer-0.3.3.tar.gz", hash = "sha256:921a37e2aefc64145e7b73d50c71bb4f26f46e4c9f414dc648c6245ff92cf7db"},
+ {file = "s3transfer-0.3.4-py2.py3-none-any.whl", hash = "sha256:1e28620e5b444652ed752cf87c7e0cb15b0e578972568c6609f0f18212f259ed"},
+ {file = "s3transfer-0.3.4.tar.gz", hash = "sha256:7fdddb4f22275cf1d32129e21f056337fd2a80b6ccef1664528145b72c49e6d2"},
]
sentry-sdk = [
{file = "sentry-sdk-0.19.5.tar.gz", hash = "sha256:737a094e49a529dd0fdcaafa9e97cf7c3d5eb964bd229821d640bc77f3502b3f"},
@@ -3775,8 +3799,8 @@ vine = [
{file = "vine-5.0.0.tar.gz", hash = "sha256:7d3b1624a953da82ef63462013bbd271d3eb75751489f9807598e8f340bd637e"},
]
virtualenv = [
- {file = "virtualenv-20.2.2-py2.py3-none-any.whl", hash = "sha256:54b05fc737ea9c9ee9f8340f579e5da5b09fb64fd010ab5757eb90268616907c"},
- {file = "virtualenv-20.2.2.tar.gz", hash = "sha256:b7a8ec323ee02fb2312f098b6b4c9de99559b462775bc8fe3627a73706603c1b"},
+ {file = "virtualenv-20.3.1-py2.py3-none-any.whl", hash = "sha256:14b34341e742bdca219e10708198e704e8a7064dd32f474fc16aca68ac53a306"},
+ {file = "virtualenv-20.3.1.tar.gz", hash = "sha256:0c111a2236b191422b37fe8c28b8c828ced39aab4bf5627fa5c331aeffb570d9"},
]
watchgod = [
{file = "watchgod-0.6-py35.py36.py37-none-any.whl", hash = "sha256:59700dab7445aa8e6067a5b94f37bae90fc367554549b1ed2e9d0f4f38a90d2a"},
diff --git a/pyproject.toml b/pyproject.toml
index 9aa5ad326a..df02a580b9 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -69,6 +69,7 @@ Adyen = "^4.0.0"
google-cloud-pubsub = ">=1.7,<3.0"
uvicorn = {extras = ["standard"], version = ">=0.12.2,<0.14.0"}
gunicorn = "^20.0.4"
+authorizenet = "^1.1.3"
[tool.poetry.dev-dependencies]
black = "20.8b1"
diff --git a/requirements.txt b/requirements.txt
index a845f7919a..a198ab6f43 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -2,6 +2,7 @@ adyen==4.0.0
amqp==5.0.2; python_version >= "3.6"
aniso8601==7.0.0
asgiref==3.3.1; python_version >= "3.6"
+authorizenet==1.1.3
babel==2.9.0; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.4.0")
beautifulsoup4==4.7.1
billiard==3.6.3.0; python_version >= "3.6"
diff --git a/requirements_dev.txt b/requirements_dev.txt
index 12541093d7..9fe52d381b 100644
--- a/requirements_dev.txt
+++ b/requirements_dev.txt
@@ -7,6 +7,7 @@ asgiref==3.3.1; python_version >= "3.6"
astroid==2.4.2; python_version >= "3.5"
atomicwrites==1.4.0; python_version >= "3.6" and python_full_version < "3.0.0" and sys_platform == "win32" and (python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6") or sys_platform == "win32" and python_version >= "3.6" and python_full_version >= "3.4.0" and (python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6")
attrs==20.3.0; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.6"
+authorizenet==1.1.3
babel==2.9.0; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.4.0")
beautifulsoup4==4.7.1
beautifultable==0.7.0
diff --git a/saleor/payment/gateways/authorize_net/__init__.py b/saleor/payment/gateways/authorize_net/__init__.py
new file mode 100644
index 0000000000..0e0be6211a
--- /dev/null
+++ b/saleor/payment/gateways/authorize_net/__init__.py
@@ -0,0 +1,457 @@
+import json
+from typing import Any, Dict, List, Optional, Tuple, Union
+
+import requests
+from authorizenet import apicontractsv1
+from authorizenet.apicontrollers import (
+ constants,
+ createTransactionController,
+ getCustomerProfileController,
+)
+from lxml import etree
+from lxml.objectify import ObjectifiedElement
+
+from ... import TransactionKind
+from ...interface import (
+ CustomerSource,
+ GatewayConfig,
+ GatewayResponse,
+ PaymentData,
+ PaymentMethodInfo,
+)
+
+
+def authenticate_test(
+ name: str, transaction_key: str, use_sandbox: bool
+) -> Tuple[bool, str]:
+ """Check if credentials are correct.
+
+ This API is not present in the authorizenet Python package.
+ https://developer.authorize.net/api/reference/index.html#gettingstarted-section-section-header
+ """
+ if use_sandbox is True:
+ url = constants.SANDBOX
+ else:
+ url = constants.PRODUCTION
+ data = {
+ "authenticateTestRequest": {
+ "merchantAuthentication": {"name": name, "transactionKey": transaction_key}
+ }
+ }
+ response = requests.post(
+ url, json=data, headers={"content-type": "application/json"}
+ )
+ # Response content is utf-8-sig, which requires usage of json.loads
+ result = json.loads(response.content)
+ message = ""
+ if result.get("messages", {}).get("resultCode") == "Ok":
+ return True, ""
+ response_message = result.get("messages", {}).get("message")
+ if len(response_message) > 0:
+ message = response_message[0].get("text", "")
+ return False, message
+
+
+def process_payment(
+ payment_information: PaymentData,
+ config: GatewayConfig,
+ user_id: Optional[int] = None,
+) -> GatewayResponse:
+ return authorize(payment_information, config, user_id=user_id)
+
+
+def capture(payment_information: PaymentData, config: GatewayConfig) -> GatewayResponse:
+ merchant_auth = _get_merchant_auth(config.connection_params)
+
+ transaction_request = apicontractsv1.transactionRequestType()
+ transaction_request.transactionType = "priorAuthCaptureTransaction"
+ transaction_request.amount = payment_information.amount
+ transaction_request.currencyCode = payment_information.currency
+ transaction_request.refTransId = payment_information.token
+
+ create_transaction_request = apicontractsv1.createTransactionRequest()
+ create_transaction_request.merchantAuthentication = merchant_auth
+ create_transaction_request.transactionRequest = transaction_request
+
+ response = _make_request(create_transaction_request, config.connection_params)
+
+ (
+ success,
+ error,
+ transaction_id,
+ transaction_response,
+ raw_response,
+ ) = _handle_authorize_net_response(response)
+ payment_method_info = _authorize_net_account_to_payment_method_info(
+ transaction_response
+ )
+ return GatewayResponse(
+ is_success=success,
+ action_required=False,
+ transaction_id=transaction_id,
+ amount=payment_information.amount,
+ currency=payment_information.currency,
+ error=error,
+ payment_method_info=payment_method_info,
+ kind=TransactionKind.CAPTURE,
+ raw_response=raw_response,
+ customer_id=payment_information.customer_id,
+ )
+
+
+def authorize(
+ payment_information: PaymentData,
+ config: GatewayConfig,
+ user_id: Optional[int] = None,
+) -> GatewayResponse:
+ """Based on AcceptSuite create-an-accept-payment-transaction example.
+
+ https://github.com/AuthorizeNet/sample-code-python/blob/master/AcceptSuite/create-an-accept-payment-transaction.py
+ """
+ kind = TransactionKind.CAPTURE if config.auto_capture else TransactionKind.AUTH
+ merchant_auth = _get_merchant_auth(config.connection_params)
+
+ # The Saleor token is the authorize.net "opaque data"
+ opaque_data = apicontractsv1.opaqueDataType()
+ opaque_data.dataDescriptor = "COMMON.ACCEPT.INAPP.PAYMENT"
+ opaque_data.dataValue = payment_information.token
+
+ payment_one = apicontractsv1.paymentType()
+ payment_one.opaqueData = opaque_data
+
+ order = apicontractsv1.orderType()
+ order.invoiceNumber = payment_information.order_id
+ order.description = ""
+
+ # An auth.net "profile" id is the id generated by auth.net.
+ # It is not the Saleor user id.
+ customer_id = (
+ payment_information.customer_id if payment_information.reuse_source else None
+ )
+
+ customer_data = apicontractsv1.customerDataType()
+ customer_data.type = "individual"
+ if user_id:
+ customer_data.id = str(user_id)
+ customer_data.email = payment_information.customer_email
+
+ transaction_request = apicontractsv1.transactionRequestType()
+ transaction_request.transactionType = (
+ "authCaptureTransaction" if config.auto_capture else "authOnlyTransaction"
+ )
+ transaction_request.amount = payment_information.amount
+ transaction_request.currencyCode = payment_information.currency
+ transaction_request.order = order
+ transaction_request.payment = payment_one
+ transaction_request.customer = customer_data
+
+ if payment_information.reuse_source and customer_id is None:
+ profile = apicontractsv1.customerProfilePaymentType()
+ profile.createProfile = True
+ transaction_request.profile = profile
+
+ if payment_information.billing:
+ customer_address = apicontractsv1.customerAddressType()
+ customer_address.firstName = payment_information.billing.first_name
+ customer_address.lastName = payment_information.billing.last_name
+ customer_address.company = payment_information.billing.company_name
+ # authorize.net support says we should not attempt submitting street_address_2
+ customer_address.address = payment_information.billing.street_address_1
+ customer_address.city = payment_information.billing.city
+ customer_address.state = payment_information.billing.country_area
+ customer_address.zip = payment_information.billing.postal_code
+ customer_address.country = payment_information.billing.country
+ transaction_request.billTo = customer_address
+
+ create_transaction_request = apicontractsv1.createTransactionRequest()
+ create_transaction_request.merchantAuthentication = merchant_auth
+ create_transaction_request.refId = str(payment_information.payment_id)
+ create_transaction_request.transactionRequest = transaction_request
+
+ response = _make_request(create_transaction_request, config.connection_params)
+
+ (
+ success,
+ error,
+ transaction_id,
+ transaction_response,
+ raw_response,
+ ) = _handle_authorize_net_response(response)
+ searchable_key = None
+ if transaction_id:
+ searchable_key = transaction_id
+ elif payment_information.token:
+ transaction_id = payment_information.token
+
+ if hasattr(response, "profileResponse") and hasattr(
+ response.profileResponse, "customerProfileId"
+ ):
+ customer_id = response.profileResponse.customerProfileId
+
+ payment_method_info = _authorize_net_account_to_payment_method_info(
+ transaction_response
+ )
+
+ return GatewayResponse(
+ is_success=success,
+ action_required=False,
+ transaction_id=transaction_id,
+ amount=payment_information.amount,
+ currency=payment_information.currency,
+ error=error,
+ payment_method_info=payment_method_info,
+ kind=kind,
+ raw_response=raw_response,
+ customer_id=customer_id,
+ searchable_key=str(searchable_key) if searchable_key else None,
+ )
+
+
+def void(payment_information: PaymentData, config: GatewayConfig) -> GatewayResponse:
+ merchant_auth = _get_merchant_auth(config.connection_params)
+
+ transaction_request = apicontractsv1.transactionRequestType()
+ transaction_request.transactionType = "voidTransaction"
+ transaction_request.refTransId = payment_information.token
+
+ create_transaction_request = apicontractsv1.createTransactionRequest()
+ create_transaction_request.merchantAuthentication = merchant_auth
+ create_transaction_request.transactionRequest = transaction_request
+
+ response = _make_request(create_transaction_request, config.connection_params)
+
+ (
+ success,
+ error,
+ transaction_id,
+ transaction_response,
+ raw_response,
+ ) = _handle_authorize_net_response(response)
+ payment_method_info = _authorize_net_account_to_payment_method_info(
+ transaction_response
+ )
+ return GatewayResponse(
+ is_success=success,
+ action_required=False,
+ transaction_id=transaction_id,
+ amount=payment_information.amount,
+ currency=payment_information.currency,
+ error=error,
+ payment_method_info=payment_method_info,
+ kind=TransactionKind.VOID,
+ raw_response=raw_response,
+ customer_id=payment_information.customer_id,
+ )
+
+
+def list_client_sources(
+ config: GatewayConfig, customer_id: str
+) -> List[CustomerSource]:
+ merchant_auth = _get_merchant_auth(config.connection_params)
+
+ get_customer_profile = apicontractsv1.getCustomerProfileRequest()
+ get_customer_profile.merchantAuthentication = merchant_auth
+ get_customer_profile.customerProfileId = customer_id
+ get_customer_profile.unmaskExpirationDate = True
+ controller = getCustomerProfileController(get_customer_profile)
+ controller.execute()
+
+ response = controller.getresponse()
+ results = []
+
+ if hasattr(response, "profile") and hasattr(response.profile, "paymentProfiles"):
+ for payment_profile in response.profile.paymentProfiles:
+ if hasattr(payment_profile, "payment") and hasattr(
+ payment_profile.payment, "creditCard"
+ ):
+ name = None
+ if hasattr(payment_profile, "billTo"):
+ first = payment_profile.billTo.firstName.pyval
+ last = payment_profile.billTo.lastName.pyval
+ if first:
+ name = first + " " + last
+ else:
+ name = last
+ card = payment_profile.payment.creditCard
+ expiration_year, expiration_month = _normalize_card_expiration(
+ card.expirationDate.pyval
+ )
+ results.append(
+ CustomerSource(
+ id=payment_profile.customerPaymentProfileId.pyval,
+ gateway="authorize.net",
+ credit_card_info=PaymentMethodInfo(
+ exp_year=expiration_year,
+ exp_month=expiration_month,
+ last_4=_normalize_last_4(card.cardNumber.pyval),
+ brand=card.cardType.pyval,
+ name=name,
+ ),
+ )
+ )
+ return results
+
+
+def refund(
+ payment_information: PaymentData, cc_last_digits: str, config: GatewayConfig
+) -> GatewayResponse:
+ merchant_auth = _get_merchant_auth(config.connection_params)
+
+ credit_card = apicontractsv1.creditCardType()
+ credit_card.cardNumber = cc_last_digits
+ credit_card.expirationDate = "XXXX"
+
+ payment = apicontractsv1.paymentType()
+ payment.creditCard = credit_card
+
+ transaction_request = apicontractsv1.transactionRequestType()
+ transaction_request.transactionType = "refundTransaction"
+ transaction_request.amount = payment_information.amount
+ transaction_request.currencyCode = payment_information.currency
+ # set refTransId to transId of a settled transaction
+ transaction_request.refTransId = payment_information.token
+ transaction_request.payment = payment
+
+ create_transaction_request = apicontractsv1.createTransactionRequest()
+ create_transaction_request.merchantAuthentication = merchant_auth
+
+ create_transaction_request.transactionRequest = transaction_request
+ response = _make_request(create_transaction_request, config.connection_params)
+
+ (
+ success,
+ error,
+ transaction_id,
+ transaction_response,
+ raw_response,
+ ) = _handle_authorize_net_response(response)
+ payment_method_info = _authorize_net_account_to_payment_method_info(
+ transaction_response
+ )
+
+ return GatewayResponse(
+ is_success=success,
+ action_required=False,
+ transaction_id=transaction_id,
+ amount=payment_information.amount,
+ currency=payment_information.currency,
+ error=error,
+ payment_method_info=payment_method_info,
+ kind=TransactionKind.REFUND,
+ raw_response=raw_response,
+ customer_id=payment_information.customer_id,
+ )
+
+
+def _handle_authorize_net_response(
+ response: ObjectifiedElement,
+) -> Tuple[bool, Optional[str], str, Any, Any]:
+ success = False
+ error: Optional[str] = None
+ transaction_id: Optional[int] = None
+ transaction_response: Any = None
+ raw_response = ""
+ if response is not None:
+ raw_response = etree.tostring(response).decode()
+ if hasattr(response, "transactionResponse"):
+ transaction_response = response.transactionResponse[0]
+ if (
+ hasattr(transaction_response, "transId")
+ and transaction_response.transId
+ ):
+ transaction_id = transaction_response.transId.pyval
+ if response.messages.resultCode == "Ok":
+ if hasattr(response.transactionResponse, "messages"):
+ success = True
+ elif hasattr(response.transactionResponse, "errors"):
+ error = response.transactionResponse.errors.error[0].errorText.pyval
+ else:
+ if hasattr(response, "transactionResponse") and hasattr(
+ response.transactionResponse, "errors"
+ ):
+ error = response.transactionResponse.errors.error[0].errorText.pyval
+ else:
+ error = response.messages.message[0]["text"].text
+ else:
+ error = "Null Response"
+ transaction_id = str(transaction_id) if transaction_id else ""
+ return (
+ success,
+ error,
+ transaction_id,
+ transaction_response,
+ raw_response,
+ )
+
+
+def _authorize_net_account_to_payment_method_info(
+ transaction_response: Union["ObjectifiedElement", None],
+) -> Optional[PaymentMethodInfo]:
+ """Transform Authorize.Net transactionResponse to Saleor credit card.
+
+ accountNumber: "XXXX0015"
+ accountType: "Mastercard"
+
+ becomes
+
+ last_4="0015"
+ brand="mastercard"
+ """
+ if (
+ transaction_response is not None
+ and hasattr(transaction_response, "accountNumber")
+ and hasattr(transaction_response, "accountType")
+ ):
+ return PaymentMethodInfo(
+ last_4=_normalize_last_4(transaction_response.accountNumber.pyval),
+ brand=transaction_response.accountType.pyval.lower(),
+ type="card",
+ )
+ return None
+
+
+def _get_merchant_auth(connection_params: Dict[str, Any]):
+ merchant_auth = apicontractsv1.merchantAuthenticationType()
+ merchant_auth.name = connection_params.get("api_login_id")
+ merchant_auth.transactionKey = connection_params.get("transaction_key")
+ return merchant_auth
+
+
+def _make_request(create_transaction_request, connection_params: Dict[str, Any]):
+ """Create an auth.net transaction controller and execute the request.
+
+ Returns auth.net response object
+ """
+ create_transaction_controller = createTransactionController(
+ create_transaction_request
+ )
+ if connection_params.get("use_sandbox") is False:
+ create_transaction_controller.setenvironment(constants.PRODUCTION)
+
+ create_transaction_controller.execute()
+
+ response = create_transaction_controller.getresponse()
+ return response
+
+
+def _normalize_last_4(account_number: str):
+ """Convert authorize.net account number to Saleor "last_4" format.
+
+ Example: XXXX1111 > 1111
+ """
+ return account_number.strip("X")
+
+
+def _normalize_card_expiration(expiration_date: str) -> List[Optional[int]]:
+ """Convert authorize.net combined expiration date into month and year.
+
+ Example: 2021-02 > [2021, 2]
+ Always return List of length 2
+ """
+ dates = expiration_date.split("-")
+ if len(dates) == 2:
+ try:
+ return [int(dates[0]), int(dates[1])]
+ except ValueError:
+ pass
+ return [None, None]
diff --git a/saleor/payment/gateways/authorize_net/plugin.py b/saleor/payment/gateways/authorize_net/plugin.py
new file mode 100644
index 0000000000..ac3d9976d9
--- /dev/null
+++ b/saleor/payment/gateways/authorize_net/plugin.py
@@ -0,0 +1,210 @@
+from typing import TYPE_CHECKING, List
+
+from django.core.exceptions import ValidationError
+
+from saleor.account.models import User
+from saleor.plugins.base_plugin import BasePlugin, ConfigurationTypeField
+from saleor.plugins.error_codes import PluginErrorCode
+
+from ... import PaymentError
+from ...models import Payment
+from ..utils import get_supported_currencies
+from . import (
+ GatewayConfig,
+ authenticate_test,
+ authorize,
+ capture,
+ list_client_sources,
+ process_payment,
+ refund,
+ void,
+)
+
+GATEWAY_NAME = "Authorize.Net"
+
+if TYPE_CHECKING:
+ # flake8: noqa
+ from ...interface import CustomerSource
+ from ..models import PluginConfiguration
+ from . import GatewayResponse, PaymentData
+
+
+def require_active_plugin(fn):
+ def wrapped(self, *args, **kwargs):
+ previous = kwargs.get("previous_value", None)
+ if not self.active:
+ return previous
+ return fn(self, *args, **kwargs)
+
+ return wrapped
+
+
+class AuthorizeNetGatewayPlugin(BasePlugin):
+ PLUGIN_NAME = GATEWAY_NAME
+ PLUGIN_ID = "mirumee.payments.authorize_net"
+
+ DEFAULT_CONFIGURATION = [
+ {"name": "api_login_id", "value": None},
+ {"name": "transaction_key", "value": None},
+ {"name": "client_key", "value": None},
+ {"name": "use_sandbox", "value": True},
+ {"name": "store_customers_card", "value": False},
+ {"name": "automatic_payment_capture", "value": True},
+ {"name": "supported_currencies", "value": ""},
+ ]
+
+ CONFIG_STRUCTURE = {
+ "api_login_id": {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": "Provide public Authorize.Net Login ID.",
+ "label": "API Login ID",
+ },
+ "transaction_key": {
+ "type": ConfigurationTypeField.SECRET,
+ "help_text": "Provide private Authorize.Net Transaction Key.",
+ "label": "Transaction Key",
+ },
+ "client_key": {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": "Provide public Authorize.Net Client Key.",
+ "label": "Client Key",
+ },
+ "use_sandbox": {
+ "type": ConfigurationTypeField.BOOLEAN,
+ "help_text": "Determines if Saleor should use Authorize.Net sandbox environment.",
+ "label": "Use sandbox",
+ },
+ "store_customers_card": {
+ "type": ConfigurationTypeField.BOOLEAN,
+ "help_text": "Determines if Saleor should store cards on payments "
+ "in Stripe customer.",
+ "label": "Store customers card",
+ },
+ "automatic_payment_capture": {
+ "type": ConfigurationTypeField.BOOLEAN,
+ "help_text": "Determines if Saleor should automatically capture payments.",
+ "label": "Automatic payment capture",
+ },
+ "supported_currencies": {
+ "type": ConfigurationTypeField.STRING,
+ "help_text": "Determines currencies supported by gateway."
+ " Please enter currency codes separated by a comma.",
+ "label": "Supported currencies",
+ },
+ }
+
+ def __init__(self, *args, **kwargs):
+ super().__init__(*args, **kwargs)
+ configuration = {item["name"]: item["value"] for item in self.configuration}
+ self.config = GatewayConfig(
+ gateway_name=GATEWAY_NAME,
+ auto_capture=configuration["automatic_payment_capture"],
+ supported_currencies=configuration["supported_currencies"],
+ connection_params={
+ "api_login_id": configuration["api_login_id"],
+ "transaction_key": configuration["transaction_key"],
+ "client_key": configuration["client_key"],
+ "use_sandbox": configuration["use_sandbox"],
+ },
+ store_customer=configuration["store_customers_card"],
+ )
+
+ def _get_gateway_config(self) -> GatewayConfig:
+ return self.config
+
+ @classmethod
+ def validate_plugin_configuration(cls, plugin_configuration: "PluginConfiguration"):
+ """Validate if provided configuration is correct."""
+ configuration = {
+ item["name"]: item["value"] for item in plugin_configuration.configuration
+ }
+
+ api_login_id = configuration.get("api_login_id", None)
+ transaction_key = configuration.get("transaction_key", None)
+
+ # Only check when active and both credentials are set
+ # Otherwise the dashboard is hard to use
+ if plugin_configuration.active and api_login_id and transaction_key:
+ use_sandbox = True if configuration.get("use_sandbox") else False
+ success, message = authenticate_test(
+ api_login_id, transaction_key, use_sandbox
+ )
+ if not success:
+ raise ValidationError(
+ {
+ "api_login_id": ValidationError(
+ message,
+ code=PluginErrorCode.PLUGIN_MISCONFIGURED.value,
+ ),
+ "transaction_key": ValidationError(
+ message,
+ code=PluginErrorCode.PLUGIN_MISCONFIGURED.value,
+ ),
+ }
+ )
+
+ @require_active_plugin
+ def authorize_payment(
+ self, payment_information: "PaymentData", previous_value
+ ) -> "GatewayResponse":
+ return authorize(payment_information, self._get_gateway_config())
+
+ @require_active_plugin
+ def capture_payment(
+ self, payment_information: "PaymentData", previous_value
+ ) -> "GatewayResponse":
+ return capture(payment_information, self._get_gateway_config())
+
+ @require_active_plugin
+ def refund_payment(
+ self, payment_information: "PaymentData", previous_value
+ ) -> "GatewayResponse":
+ try:
+ payment = Payment.objects.get(pk=payment_information.payment_id)
+ except Payment.DoesNotExist:
+ raise PaymentError(f"Cannot find Payment {payment_information.payment_id}.")
+ return refund(
+ payment_information, payment.cc_last_digits, self._get_gateway_config()
+ )
+
+ @require_active_plugin
+ def void_payment(
+ self, payment_information: "PaymentData", previous_value
+ ) -> "GatewayResponse":
+ return void(payment_information, self._get_gateway_config())
+
+ @require_active_plugin
+ def process_payment(
+ self, payment_information: "PaymentData", previous_value
+ ) -> "GatewayResponse":
+ user = User.objects.filter(
+ checkouts__payments__id=payment_information.payment_id
+ ).first()
+ user_id = user.id if user else None
+ return process_payment(payment_information, self._get_gateway_config(), user_id)
+
+ @require_active_plugin
+ def list_payment_sources(
+ self, customer_id: str, previous_value
+ ) -> List["CustomerSource"]:
+ sources = list_client_sources(self._get_gateway_config(), customer_id)
+ previous_value.extend(sources)
+ return previous_value
+
+ @require_active_plugin
+ def get_supported_currencies(self, previous_value):
+ config = self._get_gateway_config()
+ return get_supported_currencies(config, GATEWAY_NAME)
+
+ @require_active_plugin
+ def get_payment_config(self, previous_value):
+ config = self._get_gateway_config()
+ return [
+ {
+ "field": "api_login_id",
+ "value": config.connection_params["api_login_id"],
+ },
+ {"field": "client_key", "value": config.connection_params["client_key"]},
+ {"field": "use_sandbox", "value": config.connection_params["use_sandbox"]},
+ {"field": "store_customer_card", "value": config.store_customer},
+ ]
diff --git a/saleor/payment/gateways/authorize_net/tests/__init__.py b/saleor/payment/gateways/authorize_net/tests/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/saleor/payment/gateways/authorize_net/tests/cassettes/test_authenticate_test.yaml b/saleor/payment/gateways/authorize_net/tests/cassettes/test_authenticate_test.yaml
new file mode 100644
index 0000000000..387203b654
--- /dev/null
+++ b/saleor/payment/gateways/authorize_net/tests/cassettes/test_authenticate_test.yaml
@@ -0,0 +1,52 @@
+interactions:
+- request:
+ body: '{"authenticateTestRequest": {"merchantAuthentication": {"name": "test",
+ "transactionKey": "test"}}}'
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '119'
+ User-Agent:
+ - python-requests/2.24.0
+ content-type:
+ - application/json
+ method: POST
+ uri: https://apitest.authorize.net/xml/v1/request.api
+ response:
+ body:
+ string: "\uFEFF{\"messages\":{\"resultCode\":\"Ok\",\"message\":[{\"code\":\"\
+ I00001\",\"text\":\"Successful.\"}]}}"
+ headers:
+ Access-Control-Allow-Credentials:
+ - 'true'
+ Access-Control-Allow-Headers:
+ - x-requested-with,cache-control,content-type,origin,method,SOAPAction
+ Access-Control-Allow-Methods:
+ - PUT,OPTIONS,POST,GET
+ Access-Control-Allow-Origin:
+ - '*'
+ Cache-Control:
+ - no-store
+ Content-Length:
+ - '86'
+ Content-Type:
+ - application/json; charset=utf-8
+ Date:
+ - Thu, 19 Nov 2020 22:30:28 GMT
+ Pragma:
+ - no-cache
+ Strict-Transport-Security:
+ - max-age=31536000
+ X-Cnection:
+ - close
+ X-OPNET-Transaction-Trace:
+ - a2_c9f35a24-6245-4c60-b286-cafec65de713-17248-8881942
+ status:
+ code: 200
+ message: OK
+version: 1
diff --git a/saleor/payment/gateways/authorize_net/tests/cassettes/test_authenticate_test_failure.yaml b/saleor/payment/gateways/authorize_net/tests/cassettes/test_authenticate_test_failure.yaml
new file mode 100644
index 0000000000..7576b8b407
--- /dev/null
+++ b/saleor/payment/gateways/authorize_net/tests/cassettes/test_authenticate_test_failure.yaml
@@ -0,0 +1,53 @@
+interactions:
+- request:
+ body: '{"authenticateTestRequest": {"merchantAuthentication": {"name": "test",
+ "transactionKey": "test"}}}'
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '99'
+ User-Agent:
+ - python-requests/2.24.0
+ content-type:
+ - application/json
+ method: POST
+ uri: https://apitest.authorize.net/xml/v1/request.api
+ response:
+ body:
+ string: "\uFEFF{\"messages\":{\"resultCode\":\"Error\",\"message\":[{\"code\"\
+ :\"E00007\",\"text\":\"User authentication failed due to invalid authentication\
+ \ values.\"}]}}"
+ headers:
+ Access-Control-Allow-Credentials:
+ - 'true'
+ Access-Control-Allow-Headers:
+ - x-requested-with,cache-control,content-type,origin,method,SOAPAction
+ Access-Control-Allow-Methods:
+ - PUT,OPTIONS,POST,GET
+ Access-Control-Allow-Origin:
+ - '*'
+ Cache-Control:
+ - no-store
+ Content-Length:
+ - '142'
+ Content-Type:
+ - application/json; charset=utf-8
+ Date:
+ - Thu, 19 Nov 2020 22:28:46 GMT
+ Pragma:
+ - no-cache
+ Strict-Transport-Security:
+ - max-age=31536000
+ X-Cnection:
+ - close
+ X-OPNET-Transaction-Trace:
+ - a2_290dc2bf-5583-4847-b033-96a7ce2ac41d-21372-1078193
+ status:
+ code: 200
+ message: OK
+version: 1
diff --git a/saleor/payment/gateways/authorize_net/tests/cassettes/test_authorize_and_capture.yaml b/saleor/payment/gateways/authorize_net/tests/cassettes/test_authorize_and_capture.yaml
new file mode 100644
index 0000000000..4cfd4b3809
--- /dev/null
+++ b/saleor/payment/gateways/authorize_net/tests/cassettes/test_authorize_and_capture.yaml
@@ -0,0 +1,117 @@
+interactions:
+- request:
+ body: <?xml version="1.0" encoding="utf-8"?><createTransactionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"><merchantAuthentication><name>a</name><transactionKey>test</transactionKey></merchantAuthentication><clientId>sdk-python-1.1.3</clientId><refId>42</refId><transactionRequest><transactionType>authOnlyTransaction</transactionType><amount>10.0</amount><payment><opaqueData><dataDescriptor>COMMON.ACCEPT.INAPP.PAYMENT</dataDescriptor><dataValue>eyJjb2RlIjoiNTBfMl8wNjAwMDUzMDc0QjVBOTUxQjQxRTA2NTFGRDk5RjJFNjU5MTVCODNEMTM4MDczNjAxOTg3NDA5MzM4QUNBQzkxNzk2RDVCMjk5OUZENENEQkQwRjUzRTQxMDhDOUZDOUI1MEZFMzk3IiwidG9rZW4iOiI5NjA2NzUwNjg3MzY1NzgwNDA0NjAxIiwidiI6IjEuMSJ9</dataValue></opaqueData></payment><order><description></description></order><customer><type>individual</type><email>[email protected]</email></customer></transactionRequest></createTransactionRequest>
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '892'
+ Content-Type:
+ - application/xml
+ User-Agent:
+ - python-requests/2.24.0
+ encoding:
+ - utf-8
+ version:
+ - '1.0'
+ method: POST
+ uri: https://apitest.authorize.net/xml/v1/request.api
+ response:
+ body:
+ string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><createTransactionResponse\
+ \ xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\
+ \ xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\"><refId>42</refId><messages><resultCode>Ok</resultCode><message><code>I00001</code><text>Successful.</text></message></messages><transactionResponse><responseCode>1</responseCode><authCode>434GW8</authCode><avsResultCode>Y</avsResultCode><cvvResultCode>P</cvvResultCode><cavvResultCode>2</cavvResultCode><transId>60157160930</transId><refTransID\
+ \ /><transHash /><testRequest>0</testRequest><accountNumber>XXXX1111</accountNumber><accountType>Visa</accountType><messages><message><code>1</code><description>This\
+ \ transaction has been approved.</description></message></messages><transHashSha2\
+ \ /><networkTransId>UKYPLGTXHYKGCE2VTHCM41Y</networkTransId></transactionResponse></createTransactionResponse>"
+ headers:
+ Access-Control-Allow-Credentials:
+ - 'true'
+ Access-Control-Allow-Headers:
+ - x-requested-with,cache-control,content-type,origin,method,SOAPAction
+ Access-Control-Allow-Methods:
+ - PUT,OPTIONS,POST,GET
+ Access-Control-Allow-Origin:
+ - '*'
+ Cache-Control:
+ - no-store
+ Content-Length:
+ - '912'
+ Content-Type:
+ - application/xml; charset=utf-8
+ Date:
+ - Mon, 30 Nov 2020 15:38:34 GMT
+ Pragma:
+ - no-cache
+ Strict-Transport-Security:
+ - max-age=31536000
+ X-Cnection:
+ - close
+ X-OPNET-Transaction-Trace:
+ - a2_c9f35a24-6245-4c60-b286-cafec65de713-17248-26985594
+ status:
+ code: 200
+ message: OK
+- request:
+ body: <?xml version="1.0" encoding="utf-8"?><createTransactionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"><merchantAuthentication><name>test</name><transactionKey>test</transactionKey></merchantAuthentication><clientId>sdk-python-1.1.3</clientId><transactionRequest><transactionType>priorAuthCaptureTransaction</transactionType><amount>10.0</amount><refTransId>60157160930</refTransId></transactionRequest></createTransactionRequest>
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '459'
+ Content-Type:
+ - application/xml
+ User-Agent:
+ - python-requests/2.24.0
+ encoding:
+ - utf-8
+ version:
+ - '1.0'
+ method: POST
+ uri: https://apitest.authorize.net/xml/v1/request.api
+ response:
+ body:
+ string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><createTransactionResponse\
+ \ xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\
+ \ xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\"><messages><resultCode>Ok</resultCode><message><code>I00001</code><text>Successful.</text></message></messages><transactionResponse><responseCode>1</responseCode><authCode>434GW8</authCode><avsResultCode>P</avsResultCode><cvvResultCode\
+ \ /><cavvResultCode /><transId>60157160930</transId><refTransID>60157160930</refTransID><transHash\
+ \ /><testRequest>0</testRequest><accountNumber>XXXX1111</accountNumber><accountType>Visa</accountType><messages><message><code>1</code><description>This\
+ \ transaction has been approved.</description></message></messages><transHashSha2\
+ \ /></transactionResponse></createTransactionResponse>"
+ headers:
+ Access-Control-Allow-Credentials:
+ - 'true'
+ Access-Control-Allow-Headers:
+ - x-requested-with,cache-control,content-type,origin,method,SOAPAction
+ Access-Control-Allow-Methods:
+ - PUT,OPTIONS,POST,GET
+ Access-Control-Allow-Origin:
+ - '*'
+ Cache-Control:
+ - no-store
+ Content-Length:
+ - '830'
+ Content-Type:
+ - application/xml; charset=utf-8
+ Date:
+ - Mon, 30 Nov 2020 15:38:34 GMT
+ Pragma:
+ - no-cache
+ Strict-Transport-Security:
+ - max-age=31536000
+ X-Cnection:
+ - close
+ X-OPNET-Transaction-Trace:
+ - a2_fcd54fbe-2b11-4415-adab-ba5b7df2b869-17340-26993432
+ status:
+ code: 200
+ message: OK
+version: 1
diff --git a/saleor/payment/gateways/authorize_net/tests/cassettes/test_list_client_sources.yaml b/saleor/payment/gateways/authorize_net/tests/cassettes/test_list_client_sources.yaml
new file mode 100644
index 0000000000..fd93851bf9
--- /dev/null
+++ b/saleor/payment/gateways/authorize_net/tests/cassettes/test_list_client_sources.yaml
@@ -0,0 +1,57 @@
+interactions:
+- request:
+ body: <?xml version="1.0" encoding="utf-8"?><getCustomerProfileRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"><merchantAuthentication><name>public</name><transactionKey>secret</transactionKey></merchantAuthentication><clientId>sdk-python-1.1.3</clientId><customerProfileId>1929079648</customerProfileId><unmaskExpirationDate>true</unmaskExpirationDate></getCustomerProfileRequest>
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '399'
+ Content-Type:
+ - application/xml
+ User-Agent:
+ - python-requests/2.24.0
+ encoding:
+ - utf-8
+ version:
+ - '1.0'
+ method: POST
+ uri: https://apitest.authorize.net/xml/v1/request.api
+ response:
+ body:
+ string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><getCustomerProfileResponse\
+ \ xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\
+ \ xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\"><messages><resultCode>Ok</resultCode><message><code>I00001</code><text>Successful.</text></message></messages><profile><merchantCustomerId>21</merchantCustomerId><email>[email protected]</email><customerProfileId>1929079648</customerProfileId><paymentProfiles><customerType>individual</customerType><billTo><firstName>John</firstName><lastName>Doe</lastName><address>1470\
+ \ Pinewood Avenue</address><city>MICHIGAN</city><state>MI</state><zip>49855</zip><country>US</country></billTo><customerPaymentProfileId>1841309241</customerPaymentProfileId><payment><creditCard><cardNumber>XXXX1111</cardNumber><expirationDate>2021-02</expirationDate><cardType>Visa</cardType></creditCard></payment></paymentProfiles><profileType>regular</profileType></profile></getCustomerProfileResponse>"
+ headers:
+ Access-Control-Allow-Credentials:
+ - 'true'
+ Access-Control-Allow-Headers:
+ - x-requested-with,cache-control,content-type,origin,method,SOAPAction
+ Access-Control-Allow-Methods:
+ - PUT,OPTIONS,POST,GET
+ Access-Control-Allow-Origin:
+ - '*'
+ Cache-Control:
+ - no-store
+ Content-Length:
+ - '997'
+ Content-Type:
+ - application/xml; charset=utf-8
+ Date:
+ - Mon, 14 Dec 2020 15:38:38 GMT
+ Pragma:
+ - no-cache
+ Strict-Transport-Security:
+ - max-age=31536000
+ X-Cnection:
+ - close
+ X-OPNET-Transaction-Trace:
+ - a2_0ac565cf-65dd-471f-87e8-1ccb37ba4dc7-21900-10720310
+ status:
+ code: 200
+ message: OK
+version: 1
diff --git a/saleor/payment/gateways/authorize_net/tests/cassettes/test_list_client_sources_other_name.yaml b/saleor/payment/gateways/authorize_net/tests/cassettes/test_list_client_sources_other_name.yaml
new file mode 100644
index 0000000000..81012aeffb
--- /dev/null
+++ b/saleor/payment/gateways/authorize_net/tests/cassettes/test_list_client_sources_other_name.yaml
@@ -0,0 +1,57 @@
+interactions:
+- request:
+ body: <?xml version="1.0" encoding="utf-8"?><getCustomerProfileRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"><merchantAuthentication><name>public</name><transactionKey>secret</transactionKey></merchantAuthentication><clientId>sdk-python-1.1.3</clientId><customerProfileId>1929079648</customerProfileId><unmaskExpirationDate>true</unmaskExpirationDate></getCustomerProfileRequest>
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '399'
+ Content-Type:
+ - application/xml
+ User-Agent:
+ - python-requests/2.24.0
+ encoding:
+ - utf-8
+ version:
+ - '1.0'
+ method: POST
+ uri: https://apitest.authorize.net/xml/v1/request.api
+ response:
+ body:
+ string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><getCustomerProfileResponse\
+ \ xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\
+ \ xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\"><messages><resultCode>Ok</resultCode><message><code>I00001</code><text>Successful.</text></message></messages><profile><merchantCustomerId>21</merchantCustomerId><email>[email protected]</email><customerProfileId>1929079648</customerProfileId><paymentProfiles><customerType>individual</customerType><billTo><firstName></firstName><lastName>Doe</lastName><address>1470\
+ \ Pinewood Avenue</address><city>MICHIGAN</city><state>MI</state><zip>49855</zip><country>US</country></billTo><customerPaymentProfileId>1841309241</customerPaymentProfileId><payment><creditCard><cardNumber>XXXX1111</cardNumber><expirationDate>2021-02</expirationDate><cardType>Visa</cardType></creditCard></payment></paymentProfiles><profileType>regular</profileType></profile></getCustomerProfileResponse>"
+ headers:
+ Access-Control-Allow-Credentials:
+ - 'true'
+ Access-Control-Allow-Headers:
+ - x-requested-with,cache-control,content-type,origin,method,SOAPAction
+ Access-Control-Allow-Methods:
+ - PUT,OPTIONS,POST,GET
+ Access-Control-Allow-Origin:
+ - '*'
+ Cache-Control:
+ - no-store
+ Content-Length:
+ - '997'
+ Content-Type:
+ - application/xml; charset=utf-8
+ Date:
+ - Mon, 14 Dec 2020 15:38:38 GMT
+ Pragma:
+ - no-cache
+ Strict-Transport-Security:
+ - max-age=31536000
+ X-Cnection:
+ - close
+ X-OPNET-Transaction-Trace:
+ - a2_0ac565cf-65dd-471f-87e8-1ccb37ba4dc7-21900-10720310
+ status:
+ code: 200
+ message: OK
+version: 1
diff --git a/saleor/payment/gateways/authorize_net/tests/cassettes/test_payment_gateway_process_payment_production_failure.yaml b/saleor/payment/gateways/authorize_net/tests/cassettes/test_payment_gateway_process_payment_production_failure.yaml
new file mode 100644
index 0000000000..b251d57c95
--- /dev/null
+++ b/saleor/payment/gateways/authorize_net/tests/cassettes/test_payment_gateway_process_payment_production_failure.yaml
@@ -0,0 +1,58 @@
+interactions:
+- request:
+ body: <?xml version="1.0" encoding="utf-8"?><createTransactionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"><merchantAuthentication><name>public</name><transactionKey>secret</transactionKey></merchantAuthentication><clientId>sdk-python-1.1.3</clientId><refId>295</refId><transactionRequest><transactionType>authCaptureTransaction</transactionType><amount>10.0</amount><currencyCode>USD</currencyCode><payment><opaqueData><dataDescriptor>COMMON.ACCEPT.INAPP.PAYMENT</dataDescriptor><dataValue>a</dataValue></opaqueData></payment><order><description></description></order><customer><type>individual</type><email>[email protected]</email></customer></transactionRequest></createTransactionRequest>
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '697'
+ Content-Type:
+ - application/xml
+ User-Agent:
+ - python-requests/2.25.0
+ encoding:
+ - utf-8
+ version:
+ - '1.0'
+ method: POST
+ uri: https://api2.authorize.net/xml/v1/request.api
+ response:
+ body:
+ string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><createTransactionResponse\
+ \ xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\
+ \ xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\"><refId>295</refId><messages><resultCode>Error</resultCode><message><code>E00007</code><text>User\
+ \ authentication failed due to invalid authentication values.</text></message></messages><transactionResponse\
+ \ /></createTransactionResponse>"
+ headers:
+ Access-Control-Allow-Credentials:
+ - 'true'
+ Access-Control-Allow-Headers:
+ - x-requested-with,cache-control,content-type,origin,method,SOAPAction
+ Access-Control-Allow-Methods:
+ - PUT,OPTIONS,POST,GET
+ Access-Control-Allow-Origin:
+ - '*'
+ Cache-Control:
+ - no-store
+ Content-Length:
+ - '450'
+ Content-Type:
+ - application/xml; charset=utf-8
+ Date:
+ - Tue, 15 Dec 2020 19:23:02 GMT
+ Pragma:
+ - no-cache
+ Strict-Transport-Security:
+ - max-age=31536000
+ X-Cnection:
+ - close
+ X-OPNET-Transaction-Trace:
+ - a2_1a9b7ff9-4819-4b1b-ab05-09c2bc22785f-13476-279180052
+ status:
+ code: 200
+ message: OK
+version: 1
diff --git a/saleor/payment/gateways/authorize_net/tests/cassettes/test_payment_gateway_validate_production.yaml b/saleor/payment/gateways/authorize_net/tests/cassettes/test_payment_gateway_validate_production.yaml
new file mode 100644
index 0000000000..7d0d444048
--- /dev/null
+++ b/saleor/payment/gateways/authorize_net/tests/cassettes/test_payment_gateway_validate_production.yaml
@@ -0,0 +1,53 @@
+interactions:
+- request:
+ body: '{"authenticateTestRequest": {"merchantAuthentication": {"name": "public",
+ "transactionKey": "secret"}}}'
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '119'
+ User-Agent:
+ - python-requests/2.25.0
+ content-type:
+ - application/json
+ method: POST
+ uri: https://api2.authorize.net/xml/v1/request.api
+ response:
+ body:
+ string: "\uFEFF{\"messages\":{\"resultCode\":\"Error\",\"message\":[{\"code\"\
+ :\"E00007\",\"text\":\"User authentication failed due to invalid authentication\
+ \ values.\"}]}}"
+ headers:
+ Access-Control-Allow-Credentials:
+ - 'true'
+ Access-Control-Allow-Headers:
+ - x-requested-with,cache-control,content-type,origin,method,SOAPAction
+ Access-Control-Allow-Methods:
+ - PUT,OPTIONS,POST,GET
+ Access-Control-Allow-Origin:
+ - '*'
+ Cache-Control:
+ - no-store
+ Content-Length:
+ - '142'
+ Content-Type:
+ - application/json; charset=utf-8
+ Date:
+ - Tue, 15 Dec 2020 18:30:45 GMT
+ Pragma:
+ - no-cache
+ Strict-Transport-Security:
+ - max-age=31536000
+ X-Cnection:
+ - close
+ X-OPNET-Transaction-Trace:
+ - a2_bd8a9e88-53fb-4f58-844a-185161afee3c-9716-278767299
+ status:
+ code: 200
+ message: OK
+version: 1
diff --git a/saleor/payment/gateways/authorize_net/tests/cassettes/test_process_payment.yaml b/saleor/payment/gateways/authorize_net/tests/cassettes/test_process_payment.yaml
new file mode 100644
index 0000000000..14959f70d9
--- /dev/null
+++ b/saleor/payment/gateways/authorize_net/tests/cassettes/test_process_payment.yaml
@@ -0,0 +1,59 @@
+interactions:
+- request:
+ body: <?xml version="1.0" encoding="utf-8"?><createTransactionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"><merchantAuthentication><name>public</name><transactionKey>secret</transactionKey></merchantAuthentication><clientId>sdk-python-1.1.3</clientId><refId>37</refId><transactionRequest><transactionType>authCaptureTransaction</transactionType><amount>10.0</amount><payment><opaqueData><dataDescriptor>COMMON.ACCEPT.INAPP.PAYMENT</dataDescriptor><dataValue>Y29kZTo1MF8yXzA2MDAwIHRva2VuOjEgdjoxLjE=</dataValue></opaqueData></payment><order><description></description></order><customer><type>individual</type><email>[email protected]</email></customer></transactionRequest></createTransactionRequest>
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '895'
+ Content-Type:
+ - application/xml
+ User-Agent:
+ - python-requests/2.24.0
+ encoding:
+ - utf-8
+ version:
+ - '1.0'
+ method: POST
+ uri: https://apitest.authorize.net/xml/v1/request.api
+ response:
+ body:
+ string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><createTransactionResponse\
+ \ xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\
+ \ xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\"><refId>37</refId><messages><resultCode>Ok</resultCode><message><code>I00001</code><text>Successful.</text></message></messages><transactionResponse><responseCode>1</responseCode><authCode>RFR4FT</authCode><avsResultCode>Y</avsResultCode><cvvResultCode>P</cvvResultCode><cavvResultCode>2</cavvResultCode><transId>60156217587</transId><refTransID\
+ \ /><transHash /><testRequest>0</testRequest><accountNumber>XXXX1111</accountNumber><accountType>Visa</accountType><messages><message><code>1</code><description>This\
+ \ transaction has been approved.</description></message></messages><transHashSha2\
+ \ /><networkTransId>3HCLCGEXAZNFG4JR6JMEF3Q</networkTransId></transactionResponse></createTransactionResponse>"
+ headers:
+ Access-Control-Allow-Credentials:
+ - 'true'
+ Access-Control-Allow-Headers:
+ - x-requested-with,cache-control,content-type,origin,method,SOAPAction
+ Access-Control-Allow-Methods:
+ - PUT,OPTIONS,POST,GET
+ Access-Control-Allow-Origin:
+ - '*'
+ Cache-Control:
+ - no-store
+ Content-Length:
+ - '912'
+ Content-Type:
+ - application/xml; charset=utf-8
+ Date:
+ - Tue, 17 Nov 2020 15:00:09 GMT
+ Pragma:
+ - no-cache
+ Strict-Transport-Security:
+ - max-age=31536000
+ X-Cnection:
+ - close
+ X-OPNET-Transaction-Trace:
+ - a2_c9f35a24-6245-4c60-b286-cafec65de713-17248-1239206
+ status:
+ code: 200
+ message: OK
+version: 1
diff --git a/saleor/payment/gateways/authorize_net/tests/cassettes/test_process_payment_error_response.yaml b/saleor/payment/gateways/authorize_net/tests/cassettes/test_process_payment_error_response.yaml
new file mode 100644
index 0000000000..5fcb7f69de
--- /dev/null
+++ b/saleor/payment/gateways/authorize_net/tests/cassettes/test_process_payment_error_response.yaml
@@ -0,0 +1,58 @@
+interactions:
+- request:
+ body: <?xml version="1.0" encoding="utf-8"?><createTransactionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"><merchantAuthentication><name>public</name><transactionKey>secret</transactionKey></merchantAuthentication><clientId>sdk-python-1.1.3</clientId><refId>40</refId><transactionRequest><transactionType>authCaptureTransaction</transactionType><amount>10.0</amount><payment><opaqueData><dataDescriptor>COMMON.ACCEPT.INAPP.PAYMENT</dataDescriptor><dataValue>Y29kZTo1MF8yXzA2MDAwIHRva2VuOjEgdjoxLjE=</dataValue></opaqueData></payment><order><description></description></order><customer><type>individual</type><email>[email protected]</email></customer></transactionRequest></createTransactionRequest>
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '703'
+ Content-Type:
+ - application/xml
+ User-Agent:
+ - python-requests/2.24.0
+ encoding:
+ - utf-8
+ version:
+ - '1.0'
+ method: POST
+ uri: https://apitest.authorize.net/xml/v1/request.api
+ response:
+ body:
+ string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><createTransactionResponse\
+ \ xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\
+ \ xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\"><refId>40</refId><messages><resultCode>Error</resultCode><message><code>E00007</code><text>User\
+ \ authentication failed due to invalid authentication values.</text></message></messages><transactionResponse\
+ \ /></createTransactionResponse>"
+ headers:
+ Access-Control-Allow-Credentials:
+ - 'true'
+ Access-Control-Allow-Headers:
+ - x-requested-with,cache-control,content-type,origin,method,SOAPAction
+ Access-Control-Allow-Methods:
+ - PUT,OPTIONS,POST,GET
+ Access-Control-Allow-Origin:
+ - '*'
+ Cache-Control:
+ - no-store
+ Content-Length:
+ - '449'
+ Content-Type:
+ - application/xml; charset=utf-8
+ Date:
+ - Tue, 17 Nov 2020 15:34:33 GMT
+ Pragma:
+ - no-cache
+ Strict-Transport-Security:
+ - max-age=31536000
+ X-Cnection:
+ - close
+ X-OPNET-Transaction-Trace:
+ - a2_fcd54fbe-2b11-4415-adab-ba5b7df2b869-17340-1324744
+ status:
+ code: 200
+ message: OK
+version: 1
diff --git a/saleor/payment/gateways/authorize_net/tests/cassettes/test_process_payment_reuse_source.yaml b/saleor/payment/gateways/authorize_net/tests/cassettes/test_process_payment_reuse_source.yaml
new file mode 100644
index 0000000000..7f04438d0d
--- /dev/null
+++ b/saleor/payment/gateways/authorize_net/tests/cassettes/test_process_payment_reuse_source.yaml
@@ -0,0 +1,60 @@
+interactions:
+- request:
+ body: <?xml version="1.0" encoding="utf-8"?><createTransactionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"><merchantAuthentication><name>public</name><transactionKey>secret</transactionKey></merchantAuthentication><clientId>sdk-python-1.1.3</clientId><refId>215</refId><transactionRequest><transactionType>authCaptureTransaction</transactionType><amount>10.0</amount><currencyCode>USD</currencyCode><payment><opaqueData><dataDescriptor>COMMON.ACCEPT.INAPP.PAYMENT</dataDescriptor><dataValue>eyJjb2RlIjoiNTBfMl8wNjAwMDUyODA2OTkzMkM1MUVGMTUxODBCNEJBMTQ2NTk5OTI3QTM1RUUzMzAzODRDNEQ2RkQ5MkU0NzA0NUZGQzQyNENEN0VBNUZEMTNFNjdDOTFGMzU5ODIzRUIzMkY4RTUxQjlCIiwidG9rZW4iOiI5NjA4MDU1OTc0NTk2MDc4NjA0NjAxIiwidiI6IjEuMSJ9</dataValue></opaqueData></payment><profile><createProfile>true</createProfile></profile><order><description></description></order><customer><type>individual</type><id>124</id><email>[email protected]</email></customer></transactionRequest></createTransactionRequest>
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '994'
+ Content-Type:
+ - application/xml
+ User-Agent:
+ - python-requests/2.25.0
+ encoding:
+ - utf-8
+ version:
+ - '1.0'
+ method: POST
+ uri: https://apitest.authorize.net/xml/v1/request.api
+ response:
+ body:
+ string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><createTransactionResponse\
+ \ xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\
+ \ xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\"><refId>215</refId><messages><resultCode>Ok</resultCode><message><code>I00001</code><text>Successful.</text></message></messages><transactionResponse><responseCode>1</responseCode><authCode>VV8YV5</authCode><avsResultCode>Y</avsResultCode><cvvResultCode>P</cvvResultCode><cavvResultCode>2</cavvResultCode><transId>60158222968</transId><refTransID\
+ \ /><transHash /><testRequest>0</testRequest><accountNumber>XXXX1111</accountNumber><accountType>Visa</accountType><messages><message><code>1</code><description>This\
+ \ transaction has been approved.</description></message></messages><transHashSha2\
+ \ /><networkTransId>DOSERDWEAEJ83YIVZY3AB6B</networkTransId></transactionResponse><profileResponse><messages><resultCode>Ok</resultCode><message><code>I00001</code><text>Successful.</text></message></messages><customerProfileId>1929153842</customerProfileId><customerPaymentProfileIdList><numericString>1841389488</numericString></customerPaymentProfileIdList><customerShippingAddressIdList\
+ \ /></profileResponse></createTransactionResponse>"
+ headers:
+ Access-Control-Allow-Credentials:
+ - 'true'
+ Access-Control-Allow-Headers:
+ - x-requested-with,cache-control,content-type,origin,method,SOAPAction
+ Access-Control-Allow-Methods:
+ - PUT,OPTIONS,POST,GET
+ Access-Control-Allow-Origin:
+ - '*'
+ Cache-Control:
+ - no-store
+ Content-Length:
+ - '1242'
+ Content-Type:
+ - application/xml; charset=utf-8
+ Date:
+ - Tue, 15 Dec 2020 18:14:58 GMT
+ Pragma:
+ - no-cache
+ Strict-Transport-Security:
+ - max-age=31536000
+ X-Cnection:
+ - close
+ X-OPNET-Transaction-Trace:
+ - a2_0ac565cf-65dd-471f-87e8-1ccb37ba4dc7-21900-12345128
+ status:
+ code: 200
+ message: OK
+version: 1
diff --git a/saleor/payment/gateways/authorize_net/tests/cassettes/test_process_payment_with_user.yaml b/saleor/payment/gateways/authorize_net/tests/cassettes/test_process_payment_with_user.yaml
new file mode 100644
index 0000000000..3c20ed5661
--- /dev/null
+++ b/saleor/payment/gateways/authorize_net/tests/cassettes/test_process_payment_with_user.yaml
@@ -0,0 +1,61 @@
+interactions:
+- request:
+ body: "<?xml version=\"1.0\" encoding=\"utf-8\"?><createTransactionRequest xmlns=\"\
+ AnetApi/xml/v1/schema/AnetApiSchema.xsd\"><merchantAuthentication><name>public</name><transactionKey>secret</transactionKey></merchantAuthentication><clientId>sdk-python-1.1.3</clientId><refId>200</refId><transactionRequest><transactionType>authCaptureTransaction</transactionType><amount>10.0</amount><currencyCode>USD</currencyCode><payment><opaqueData><dataDescriptor>COMMON.ACCEPT.INAPP.PAYMENT</dataDescriptor><dataValue>eyJjb2RlIjoiNTBfMl8wNjAwMDUzNTkwQTBCNEMwRDg3RkY2RTdBQ0YxNUMzRTg4ODRDOEI1ODIwODA5NUExQ0U2ODM3MUJCNzIwMTZGQ0E5NDdGNjY5ODAyMTU2NTkxQjI4MDM0OTBGRDRCODcxMDgwNTQxIiwidG9rZW4iOiI5NjA4MDUxMDYzMDAxMDYxNTA0NjAxIiwidiI6IjEuMSJ9</dataValue></opaqueData></payment><order><description></description></order><customer><type>individual</type><id>123</id><email>[email protected]</email></customer><billTo><firstName>John</firstName><lastName>Doe</lastName><company>Mirumee\
+ \ Software</company><address>T\u0119czowa 7</address><city>WROC\u0141AW</city><state></state><zip>53-601</zip><country>PL</country></billTo></transactionRequest></createTransactionRequest>"
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '1146'
+ Content-Type:
+ - application/xml
+ User-Agent:
+ - python-requests/2.25.0
+ encoding:
+ - utf-8
+ version:
+ - '1.0'
+ method: POST
+ uri: https://apitest.authorize.net/xml/v1/request.api
+ response:
+ body:
+ string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><createTransactionResponse\
+ \ xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\
+ \ xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\"><refId>200</refId><messages><resultCode>Ok</resultCode><message><code>I00001</code><text>Successful.</text></message></messages><transactionResponse><responseCode>1</responseCode><authCode>CYC2CI</authCode><avsResultCode>Y</avsResultCode><cvvResultCode>P</cvvResultCode><cavvResultCode>2</cavvResultCode><transId>60158219030</transId><refTransID\
+ \ /><transHash /><testRequest>0</testRequest><accountNumber>XXXX1111</accountNumber><accountType>Visa</accountType><messages><message><code>1</code><description>This\
+ \ transaction has been approved.</description></message></messages><transHashSha2\
+ \ /><networkTransId>YUB9211Y3WQH5BO8WVGTPK2</networkTransId></transactionResponse></createTransactionResponse>"
+ headers:
+ Access-Control-Allow-Credentials:
+ - 'true'
+ Access-Control-Allow-Headers:
+ - x-requested-with,cache-control,content-type,origin,method,SOAPAction
+ Access-Control-Allow-Methods:
+ - PUT,OPTIONS,POST,GET
+ Access-Control-Allow-Origin:
+ - '*'
+ Cache-Control:
+ - no-store
+ Content-Length:
+ - '913'
+ Content-Type:
+ - application/xml; charset=utf-8
+ Date:
+ - Tue, 15 Dec 2020 16:51:39 GMT
+ Pragma:
+ - no-cache
+ Strict-Transport-Security:
+ - max-age=31536000
+ X-Cnection:
+ - close
+ X-OPNET-Transaction-Trace:
+ - a2_0ac565cf-65dd-471f-87e8-1ccb37ba4dc7-21900-12262522
+ status:
+ code: 200
+ message: OK
+version: 1
diff --git a/saleor/payment/gateways/authorize_net/tests/cassettes/test_refund.yaml b/saleor/payment/gateways/authorize_net/tests/cassettes/test_refund.yaml
new file mode 100644
index 0000000000..a94242fefb
--- /dev/null
+++ b/saleor/payment/gateways/authorize_net/tests/cassettes/test_refund.yaml
@@ -0,0 +1,60 @@
+interactions:
+- request:
+ body: <?xml version="1.0" encoding="utf-8"?><createTransactionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"><merchantAuthentication><name>test</name><transactionKey>test</transactionKey></merchantAuthentication><clientId>sdk-python-1.1.3</clientId><transactionRequest><transactionType>refundTransaction</transactionType><amount>10.0</amount><payment><creditCard><cardNumber>1111</cardNumber><expirationDate>XXXX</expirationDate></creditCard></payment><refTransId>60156675146</refTransId></transactionRequest></createTransactionRequest>
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '559'
+ Content-Type:
+ - application/xml
+ User-Agent:
+ - python-requests/2.24.0
+ encoding:
+ - utf-8
+ version:
+ - '1.0'
+ method: POST
+ uri: https://apitest.authorize.net/xml/v1/request.api
+ response:
+ body:
+ string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><createTransactionResponse\
+ \ xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\
+ \ xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\"><messages><resultCode>Ok</resultCode><message><code>I00001</code><text>Successful.</text></message></messages><transactionResponse><responseCode>1</responseCode><authCode\
+ \ /><avsResultCode>P</avsResultCode><cvvResultCode /><cavvResultCode /><transId>60156757629</transId><refTransID>60156675146</refTransID><transHash\
+ \ /><testRequest>0</testRequest><accountNumber>XXXX1111</accountNumber><accountType>Visa</accountType><messages><message><code>1</code><description>This\
+ \ transaction has been approved.</description></message></messages><transHashSha2\
+ \ /></transactionResponse></createTransactionResponse>"
+ headers:
+ Access-Control-Allow-Credentials:
+ - 'true'
+ Access-Control-Allow-Headers:
+ - x-requested-with,cache-control,content-type,origin,method,SOAPAction
+ Access-Control-Allow-Methods:
+ - PUT,OPTIONS,POST,GET
+ Access-Control-Allow-Origin:
+ - '*'
+ Cache-Control:
+ - no-store
+ Content-Length:
+ - '815'
+ Content-Type:
+ - application/xml; charset=utf-8
+ Date:
+ - Tue, 24 Nov 2020 20:49:09 GMT
+ Pragma:
+ - no-cache
+ Strict-Transport-Security:
+ - max-age=31536000
+ X-Cnection:
+ - close
+ X-OPNET-Transaction-Trace:
+ - a2_c9f35a24-6245-4c60-b286-cafec65de713-17248-17900192
+ status:
+ code: 200
+ message: OK
+version: 1
diff --git a/saleor/payment/gateways/authorize_net/tests/cassettes/test_refund_error.yaml b/saleor/payment/gateways/authorize_net/tests/cassettes/test_refund_error.yaml
new file mode 100644
index 0000000000..a682175843
--- /dev/null
+++ b/saleor/payment/gateways/authorize_net/tests/cassettes/test_refund_error.yaml
@@ -0,0 +1,58 @@
+interactions:
+- request:
+ body: <?xml version="1.0" encoding="utf-8"?><createTransactionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"><merchantAuthentication><name>public</name><transactionKey>secret</transactionKey></merchantAuthentication><clientId>sdk-python-1.1.3</clientId><transactionRequest><transactionType>refundTransaction</transactionType><amount>10.0</amount><payment><creditCard><cardNumber>1111</cardNumber><expirationDate>XXXX</expirationDate></creditCard></payment><refTransId>test</refTransId></transactionRequest></createTransactionRequest>
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '536'
+ Content-Type:
+ - application/xml
+ User-Agent:
+ - python-requests/2.24.0
+ encoding:
+ - utf-8
+ version:
+ - '1.0'
+ method: POST
+ uri: https://apitest.authorize.net/xml/v1/request.api
+ response:
+ body:
+ string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><createTransactionResponse\
+ \ xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\
+ \ xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\"><messages><resultCode>Error</resultCode><message><code>E00007</code><text>User\
+ \ authentication failed due to invalid authentication values.</text></message></messages><transactionResponse\
+ \ /></createTransactionResponse>"
+ headers:
+ Access-Control-Allow-Credentials:
+ - 'true'
+ Access-Control-Allow-Headers:
+ - x-requested-with,cache-control,content-type,origin,method,SOAPAction
+ Access-Control-Allow-Methods:
+ - PUT,OPTIONS,POST,GET
+ Access-Control-Allow-Origin:
+ - '*'
+ Cache-Control:
+ - no-store
+ Content-Length:
+ - '432'
+ Content-Type:
+ - application/xml; charset=utf-8
+ Date:
+ - Tue, 24 Nov 2020 20:43:15 GMT
+ Pragma:
+ - no-cache
+ Strict-Transport-Security:
+ - max-age=31536000
+ X-Cnection:
+ - close
+ X-OPNET-Transaction-Trace:
+ - a2_fcd54fbe-2b11-4415-adab-ba5b7df2b869-17340-17896222
+ status:
+ code: 200
+ message: OK
+version: 1
diff --git a/saleor/payment/gateways/authorize_net/tests/cassettes/test_void.yaml b/saleor/payment/gateways/authorize_net/tests/cassettes/test_void.yaml
new file mode 100644
index 0000000000..1c7b9f4ba0
--- /dev/null
+++ b/saleor/payment/gateways/authorize_net/tests/cassettes/test_void.yaml
@@ -0,0 +1,60 @@
+interactions:
+- request:
+ body: <?xml version="1.0" encoding="utf-8"?><createTransactionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"><merchantAuthentication><name>public</name><transactionKey>secret</transactionKey></merchantAuthentication><clientId>sdk-python-1.1.3</clientId><transactionRequest><transactionType>voidTransaction</transactionType><refTransId>60157165182</refTransId></transactionRequest></createTransactionRequest>
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '426'
+ Content-Type:
+ - application/xml
+ User-Agent:
+ - python-requests/2.24.0
+ encoding:
+ - utf-8
+ version:
+ - '1.0'
+ method: POST
+ uri: https://apitest.authorize.net/xml/v1/request.api
+ response:
+ body:
+ string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><createTransactionResponse\
+ \ xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\
+ \ xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\"><messages><resultCode>Ok</resultCode><message><code>I00001</code><text>Successful.</text></message></messages><transactionResponse><responseCode>1</responseCode><authCode>Y2P72J</authCode><avsResultCode>P</avsResultCode><cvvResultCode\
+ \ /><cavvResultCode /><transId>60157165182</transId><refTransID>60157165182</refTransID><transHash\
+ \ /><testRequest>0</testRequest><accountNumber>XXXX1111</accountNumber><accountType>Visa</accountType><messages><message><code>1</code><description>This\
+ \ transaction has been approved.</description></message></messages><transHashSha2\
+ \ /></transactionResponse></createTransactionResponse>"
+ headers:
+ Access-Control-Allow-Credentials:
+ - 'true'
+ Access-Control-Allow-Headers:
+ - x-requested-with,cache-control,content-type,origin,method,SOAPAction
+ Access-Control-Allow-Methods:
+ - PUT,OPTIONS,POST,GET
+ Access-Control-Allow-Origin:
+ - '*'
+ Cache-Control:
+ - no-store
+ Content-Length:
+ - '830'
+ Content-Type:
+ - application/xml; charset=utf-8
+ Date:
+ - Mon, 30 Nov 2020 18:38:37 GMT
+ Pragma:
+ - no-cache
+ Strict-Transport-Security:
+ - max-age=31536000
+ X-Cnection:
+ - close
+ X-OPNET-Transaction-Trace:
+ - a2_fcd54fbe-2b11-4415-adab-ba5b7df2b869-17340-27161825
+ status:
+ code: 200
+ message: OK
+version: 1
diff --git a/saleor/payment/gateways/authorize_net/tests/cassettes/test_void_duplicate.yaml b/saleor/payment/gateways/authorize_net/tests/cassettes/test_void_duplicate.yaml
new file mode 100644
index 0000000000..95fcb39436
--- /dev/null
+++ b/saleor/payment/gateways/authorize_net/tests/cassettes/test_void_duplicate.yaml
@@ -0,0 +1,60 @@
+interactions:
+- request:
+ body: <?xml version="1.0" encoding="utf-8"?><createTransactionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"><merchantAuthentication><name>public</name><transactionKey>secret</transactionKey></merchantAuthentication><clientId>sdk-python-1.1.3</clientId><transactionRequest><transactionType>voidTransaction</transactionType><refTransId>60157165182</refTransId></transactionRequest></createTransactionRequest>
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '426'
+ Content-Type:
+ - application/xml
+ User-Agent:
+ - python-requests/2.24.0
+ encoding:
+ - utf-8
+ version:
+ - '1.0'
+ method: POST
+ uri: https://apitest.authorize.net/xml/v1/request.api
+ response:
+ body:
+ string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><createTransactionResponse\
+ \ xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\
+ \ xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\"><messages><resultCode>Ok</resultCode><message><code>I00001</code><text>Successful.</text></message></messages><transactionResponse><responseCode>1</responseCode><authCode\
+ \ /><avsResultCode>P</avsResultCode><cvvResultCode /><cavvResultCode /><transId>0</transId><refTransID>60157165182</refTransID><transHash\
+ \ /><testRequest>0</testRequest><accountNumber /><accountType>Visa</accountType><messages><message><code>310</code><description>This\
+ \ transaction has already been voided.</description></message></messages><transHashSha2\
+ \ /></transactionResponse></createTransactionResponse>"
+ headers:
+ Access-Control-Allow-Credentials:
+ - 'true'
+ Access-Control-Allow-Headers:
+ - x-requested-with,cache-control,content-type,origin,method,SOAPAction
+ Access-Control-Allow-Methods:
+ - PUT,OPTIONS,POST,GET
+ Access-Control-Allow-Origin:
+ - '*'
+ Cache-Control:
+ - no-store
+ Content-Length:
+ - '791'
+ Content-Type:
+ - application/xml; charset=utf-8
+ Date:
+ - Mon, 30 Nov 2020 18:40:19 GMT
+ Pragma:
+ - no-cache
+ Strict-Transport-Security:
+ - max-age=31536000
+ X-Cnection:
+ - close
+ X-OPNET-Transaction-Trace:
+ - a2_c9f35a24-6245-4c60-b286-cafec65de713-17248-27154982
+ status:
+ code: 200
+ message: OK
+version: 1
diff --git a/saleor/payment/gateways/authorize_net/tests/cassettes/test_void_failure.yaml b/saleor/payment/gateways/authorize_net/tests/cassettes/test_void_failure.yaml
new file mode 100644
index 0000000000..5a1833f3ce
--- /dev/null
+++ b/saleor/payment/gateways/authorize_net/tests/cassettes/test_void_failure.yaml
@@ -0,0 +1,61 @@
+interactions:
+- request:
+ body: <?xml version="1.0" encoding="utf-8"?><createTransactionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"><merchantAuthentication><name>public</name><transactionKey>secret</transactionKey></merchantAuthentication><clientId>sdk-python-1.1.3</clientId><transactionRequest><transactionType>voidTransaction</transactionType><refTransId>601572</refTransId></transactionRequest></createTransactionRequest>
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '421'
+ Content-Type:
+ - application/xml
+ User-Agent:
+ - python-requests/2.24.0
+ encoding:
+ - utf-8
+ version:
+ - '1.0'
+ method: POST
+ uri: https://apitest.authorize.net/xml/v1/request.api
+ response:
+ body:
+ string: "\uFEFF<?xml version=\"1.0\" encoding=\"utf-8\"?><createTransactionResponse\
+ \ xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\
+ \ xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\"><messages><resultCode>Error</resultCode><message><code>E00027</code><text>The\
+ \ transaction was unsuccessful.</text></message></messages><transactionResponse><responseCode>3</responseCode><authCode\
+ \ /><avsResultCode>P</avsResultCode><cvvResultCode /><cavvResultCode /><transId>0</transId><refTransID>601572</refTransID><transHash\
+ \ /><testRequest>0</testRequest><accountNumber /><accountType /><errors><error><errorCode>16</errorCode><errorText>The\
+ \ transaction cannot be found.</errorText></error></errors><shipTo /><transHashSha2\
+ \ /></transactionResponse></createTransactionResponse>"
+ headers:
+ Access-Control-Allow-Credentials:
+ - 'true'
+ Access-Control-Allow-Headers:
+ - x-requested-with,cache-control,content-type,origin,method,SOAPAction
+ Access-Control-Allow-Methods:
+ - PUT,OPTIONS,POST,GET
+ Access-Control-Allow-Origin:
+ - '*'
+ Cache-Control:
+ - no-store
+ Content-Length:
+ - '793'
+ Content-Type:
+ - application/xml; charset=utf-8
+ Date:
+ - Mon, 30 Nov 2020 18:42:50 GMT
+ Pragma:
+ - no-cache
+ Strict-Transport-Security:
+ - max-age=31536000
+ X-Cnection:
+ - close
+ X-OPNET-Transaction-Trace:
+ - a2_fcd54fbe-2b11-4415-adab-ba5b7df2b869-17340-27164037
+ status:
+ code: 200
+ message: OK
+version: 1
diff --git a/saleor/payment/gateways/authorize_net/tests/conftest.py b/saleor/payment/gateways/authorize_net/tests/conftest.py
new file mode 100644
index 0000000000..a581570049
--- /dev/null
+++ b/saleor/payment/gateways/authorize_net/tests/conftest.py
@@ -0,0 +1,73 @@
+from unittest import mock
+
+import pytest
+
+from .....plugins.manager import get_plugins_manager
+from ....interface import GatewayConfig
+from ..plugin import AuthorizeNetGatewayPlugin
+
+
+def authorize_net_gateway_config():
+ return GatewayConfig(
+ gateway_name="authorize_net",
+ auto_capture=True,
+ supported_currencies="USD",
+ connection_params={
+ "api_login_id": "public",
+ "transaction_key": "secret",
+ "client_key": "public",
+ "use_sandbox": True,
+ },
+ )
+
+
+def authorize_net_payment(payment_dummy):
+ payment_dummy.gateway = "mirumee.payments.authorize_net"
+ return payment_dummy
+
+
+ "saleor.payment.gateways.authorize_net.plugin.AuthorizeNetGatewayPlugin"
+ ".validate_plugin_configuration"
+)
+def authorize_net_plugin(_, settings, authorize_net_gateway_config):
+ settings.PLUGINS = [
+ "saleor.payment.gateways.authorize_net.plugin.AuthorizeNetGatewayPlugin"
+ ]
+ manager = get_plugins_manager()
+
+ connection_params = authorize_net_gateway_config.connection_params
+
+ manager.save_plugin_configuration(
+ AuthorizeNetGatewayPlugin.PLUGIN_ID,
+ {
+ "active": True,
+ "configuration": [
+ {"name": "api_login_id", "value": connection_params["api_login_id"]},
+ {
+ "name": "transaction_key",
+ "value": connection_params["transaction_key"],
+ },
+ {"name": "client_key", "value": connection_params["client_key"]},
+ {"name": "use_sandbox", "value": connection_params["use_sandbox"]},
+ {
+ "name": "store_customers_card",
+ "value": authorize_net_gateway_config.store_customer,
+ },
+ {
+ "name": "automatic_payment_capture",
+ "value": authorize_net_gateway_config.auto_capture,
+ },
+ {
+ "name": "supported_currencies",
+ "value": authorize_net_gateway_config.supported_currencies,
+ },
+ ],
+ },
+ )
+
+ manager = get_plugins_manager()
+ return manager.plugins[0]
diff --git a/saleor/payment/gateways/authorize_net/tests/test_authorize_net.py b/saleor/payment/gateways/authorize_net/tests/test_authorize_net.py
new file mode 100644
index 0000000000..ba1318daa2
--- /dev/null
+++ b/saleor/payment/gateways/authorize_net/tests/test_authorize_net.py
@@ -0,0 +1,284 @@
+import pytest
+
+from .... import TransactionKind
+from ....interface import PaymentData
+from .. import (
+ authenticate_test,
+ capture,
+ list_client_sources,
+ process_payment,
+ refund,
+ void,
+)
+
+INVALID_TOKEN = "Y29kZTo1MF8yXzA2MDAwIHRva2VuOjEgdjoxLjE="
+SUCCESS_TRANSACTION_ID = "60156217587"
+REFUND_AMOUNT = 10.0
+REFUND_TOKEN = "test"
+
+
+def test_authenticate_test():
+ success, _ = authenticate_test("test", "test", True)
+ assert success
+
+
+def test_authenticate_test_failure():
+ success, message = authenticate_test("test", "test", True)
+ assert not success
+ assert message == "User authentication failed due to invalid authentication values."
+
+
+def test_process_payment(dummy_payment_data, authorize_net_gateway_config):
+ dummy_payment_data.token = INVALID_TOKEN
+ response = process_payment(dummy_payment_data, authorize_net_gateway_config)
+ assert not response.error
+ assert response.transaction_id == SUCCESS_TRANSACTION_ID
+ assert response.kind == TransactionKind.CAPTURE
+ assert response.is_success
+ assert response.amount == dummy_payment_data.amount
+ assert response.currency == dummy_payment_data.currency
+ assert not response.action_required
+
+
+def test_process_payment_with_user(
+ dummy_payment_data, authorize_net_gateway_config, address
+):
+ dummy_payment_data.token = INVALID_TOKEN
+ dummy_payment_data.billing = address
+ user_id = 123
+ response = process_payment(
+ dummy_payment_data, authorize_net_gateway_config, user_id
+ )
+ assert not response.error
+ assert response.kind == TransactionKind.CAPTURE
+ assert response.is_success
+ assert response.amount == dummy_payment_data.amount
+ assert response.currency == dummy_payment_data.currency
+
+
+def test_process_payment_reuse_source(dummy_payment_data, authorize_net_gateway_config):
+ dummy_payment_data.token = INVALID_TOKEN
+ dummy_payment_data.reuse_source = True
+ user_id = 124
+ response = process_payment(
+ dummy_payment_data, authorize_net_gateway_config, user_id
+ )
+ assert not response.error
+ assert response.kind == TransactionKind.CAPTURE
+ assert response.is_success
+ assert response.customer_id == 1929153842
+
+
+def test_process_payment_error_response(
+ dummy_payment_data, authorize_net_gateway_config
+):
+ dummy_payment_data.token = INVALID_TOKEN
+ response = process_payment(dummy_payment_data, authorize_net_gateway_config)
+ assert (
+ response.error
+ == "User authentication failed due to invalid authentication values."
+ )
+ assert response.transaction_id == INVALID_TOKEN
+ assert response.kind == TransactionKind.CAPTURE
+ assert not response.is_success
+ assert response.amount == dummy_payment_data.amount
+ assert response.currency == dummy_payment_data.currency
+ assert not response.action_required
+
+
+def test_process_payment_error_response_null(
+ dummy_payment_data, authorize_net_gateway_config
+):
+ dummy_payment_data.token = INVALID_TOKEN
+ response = process_payment(dummy_payment_data, authorize_net_gateway_config)
+ assert response.error == "Null Response"
+ assert not response.is_success
+
+
+def test_refund(authorize_net_payment, authorize_net_gateway_config):
+ payment_data = PaymentData(
+ REFUND_AMOUNT,
+ "USD",
+ None,
+ None,
+ payment_id=authorize_net_payment.pk,
+ graphql_payment_id=None,
+ order_id=authorize_net_payment.order_id,
+ customer_ip_address=authorize_net_payment.customer_ip_address,
+ customer_email=authorize_net_payment.billing_email,
+ token=REFUND_TOKEN,
+ )
+ response = refund(
+ payment_data,
+ authorize_net_payment.cc_last_digits,
+ authorize_net_gateway_config,
+ )
+ assert not response.error
+ assert response.kind == TransactionKind.REFUND
+ assert response.is_success
+
+
+def test_refund_error(authorize_net_payment, authorize_net_gateway_config):
+ payment_data = PaymentData(
+ REFUND_AMOUNT,
+ "USD",
+ None,
+ None,
+ payment_id=authorize_net_payment.pk,
+ graphql_payment_id=None,
+ order_id=authorize_net_payment.order_id,
+ customer_ip_address=authorize_net_payment.customer_ip_address,
+ customer_email=authorize_net_payment.billing_email,
+ token=REFUND_TOKEN,
+ )
+ response = refund(
+ payment_data,
+ authorize_net_payment.cc_last_digits,
+ authorize_net_gateway_config,
+ )
+ assert response.error
+ assert response.kind == TransactionKind.REFUND
+ assert not response.is_success
+
+
+def test_authorize_and_capture(dummy_payment_data, authorize_net_gateway_config):
+ dummy_payment_data.token = INVALID_TOKEN
+ authorize_net_gateway_config.auto_capture = False
+
+ response = process_payment(dummy_payment_data, authorize_net_gateway_config)
+ transaction_id = response.transaction_id
+ assert not response.error
+ assert response.kind == TransactionKind.AUTH
+ assert response.is_success
+ assert response.amount == dummy_payment_data.amount
+ assert response.currency == dummy_payment_data.currency
+ assert not response.action_required
+
+ dummy_payment_data.token = str(transaction_id)
+ response = capture(dummy_payment_data, authorize_net_gateway_config)
+ assert not response.error
+ assert response.kind == TransactionKind.CAPTURE
+ assert response.is_success
+ assert response.amount == dummy_payment_data.amount
+ assert response.currency == dummy_payment_data.currency
+ assert not response.action_required
+
+
+def test_void(authorize_net_payment, authorize_net_gateway_config):
+ payment_data = PaymentData(
+ None,
+ None,
+ None,
+ None,
+ payment_id=authorize_net_payment.pk,
+ graphql_payment_id=None,
+ order_id=authorize_net_payment.order_id,
+ customer_ip_address=authorize_net_payment.customer_ip_address,
+ customer_email=authorize_net_payment.billing_email,
+ token="1",
+ )
+ response = void(
+ payment_data,
+ authorize_net_gateway_config,
+ )
+ assert not response.error
+ assert response.kind == TransactionKind.VOID
+ assert response.is_success
+
+
+def test_void_duplicate(authorize_net_payment, authorize_net_gateway_config):
+ """
+ Tests already voided transaction
+ Authorize.net considers this a successful transaction
+ """
+ payment_data = PaymentData(
+ None,
+ None,
+ None,
+ None,
+ payment_id=authorize_net_payment.pk,
+ graphql_payment_id=None,
+ order_id=authorize_net_payment.order_id,
+ customer_ip_address=authorize_net_payment.customer_ip_address,
+ customer_email=authorize_net_payment.billing_email,
+ token="1",
+ )
+ response = void(
+ payment_data,
+ authorize_net_gateway_config,
+ )
+ assert not response.error
+ assert response.kind == TransactionKind.VOID
+ assert response.is_success
+
+
+def test_void_failure(authorize_net_payment, authorize_net_gateway_config):
+ """ Tess with invalid transaction id """
+ payment_data = PaymentData(
+ None,
+ None,
+ None,
+ None,
+ payment_id=authorize_net_payment.pk,
+ graphql_payment_id=None,
+ order_id=authorize_net_payment.order_id,
+ customer_ip_address=authorize_net_payment.customer_ip_address,
+ customer_email=authorize_net_payment.billing_email,
+ token="1",
+ )
+ response = void(
+ payment_data,
+ authorize_net_gateway_config,
+ )
+ assert response.error
+ assert response.kind == TransactionKind.VOID
+ assert not response.is_success
+
+
+def test_list_client_sources(authorize_net_gateway_config):
+ customer_id = "1929079648"
+ response = list_client_sources(authorize_net_gateway_config, customer_id)
+ assert len(response) == 1
+ assert response[0].id == 1841309241
+ assert response[0].credit_card_info.last_4 == "1111"
+ assert response[0].credit_card_info.exp_year == 2021
+ assert response[0].credit_card_info.exp_month == 2
+ assert response[0].credit_card_info.brand == "Visa"
+ assert response[0].credit_card_info.name == "John Doe"
+
+
+def test_list_client_sources_other_name(authorize_net_gateway_config):
+ customer_id = "1929079648"
+ response = list_client_sources(authorize_net_gateway_config, customer_id)
+ assert len(response) == 1
+ assert response[0].credit_card_info.name == "Doe"
diff --git a/saleor/payment/gateways/authorize_net/tests/test_plugin.py b/saleor/payment/gateways/authorize_net/tests/test_plugin.py
new file mode 100644
index 0000000000..53581ae0d9
--- /dev/null
+++ b/saleor/payment/gateways/authorize_net/tests/test_plugin.py
@@ -0,0 +1,147 @@
+from unittest import mock
+
+import pytest
+from django.core.exceptions import ValidationError
+
+from .... import PaymentError
+from ..plugin import AuthorizeNetGatewayPlugin
+
+
+def test_get_payment_gateway_for_checkout(
+ authorize_net_plugin, checkout_with_single_item, address
+):
+ checkout_with_single_item.billing_address = address
+ checkout_with_single_item.save()
+ response = authorize_net_plugin.get_payment_gateway_for_checkout(
+ checkout_with_single_item, None
+ )
+ assert response.id == authorize_net_plugin.PLUGIN_ID
+ assert response.name == authorize_net_plugin.PLUGIN_NAME
+ config = response.config
+ assert len(config) == 4
+ assert config[0] == {
+ "field": "api_login_id",
+ "value": authorize_net_plugin.config.connection_params["api_login_id"],
+ }
+ assert config[1] == {
+ "field": "client_key",
+ "value": authorize_net_plugin.config.connection_params["client_key"],
+ }
+ assert config[2] == {
+ "field": "use_sandbox",
+ "value": authorize_net_plugin.config.connection_params["use_sandbox"],
+ }
+ assert config[3] == {
+ "field": "store_customer_card",
+ "value": authorize_net_plugin.config.store_customer,
+ }
+
+
+def test_get_payment_gateway_for_checkout_inactive(
+ authorize_net_plugin, checkout_with_single_item
+):
+ authorize_net_plugin.active = False
+ response = authorize_net_plugin.get_payment_gateway_for_checkout(
+ checkout_with_single_item, None
+ )
+ assert not response
+
+
[email protected]("saleor.payment.gateways.authorize_net.plugin.authenticate_test")
+def test_payment_gateway_validate(mocked_authenticate_test, authorize_net_plugin):
+ mocked_authenticate_test.return_value = (True, "")
+ response = AuthorizeNetGatewayPlugin.validate_plugin_configuration(
+ authorize_net_plugin
+ )
+ assert not response
+
+
+def test_payment_gateway_validate_production(authorize_net_plugin):
+ for config in authorize_net_plugin.configuration:
+ if config["name"] == "use_sandbox":
+ config["value"] = False
+ with pytest.raises(ValidationError):
+ AuthorizeNetGatewayPlugin.validate_plugin_configuration(authorize_net_plugin)
+
+
+def test_payment_gateway_process_payment_production_failure(
+ authorize_net_plugin, dummy_payment_data
+):
+ authorize_net_plugin.config.connection_params["use_sandbox"] = False
+ dummy_payment_data.token = "a"
+ response = authorize_net_plugin.process_payment(dummy_payment_data, None)
+ assert not response.is_success
+
+
[email protected]("saleor.payment.gateways.authorize_net.plugin.authenticate_test")
+def test_payment_gateway_validate_failure(
+ mocked_authenticate_test, authorize_net_plugin
+):
+ mocked_authenticate_test.return_value = (False, "")
+ with pytest.raises(ValidationError):
+ AuthorizeNetGatewayPlugin.validate_plugin_configuration(authorize_net_plugin)
+
+
[email protected]("saleor.payment.gateways.authorize_net.plugin.refund")
+def test_payment_gateway_refund_payment(
+ mocked_refund, authorize_net_plugin, dummy_payment_data
+):
+ mocked_refund.return_value(None)
+ authorize_net_plugin.refund_payment(dummy_payment_data, None)
+ mocked_refund.assert_called_with(
+ dummy_payment_data, "1111", authorize_net_plugin._get_gateway_config()
+ )
+
+
+def test_payment_gateway_refund_payment_no_payment(
+ authorize_net_plugin, dummy_payment_data
+):
+ dummy_payment_data.payment_id = 100
+ with pytest.raises(PaymentError):
+ authorize_net_plugin.refund_payment(dummy_payment_data, None)
+
+
[email protected]("saleor.payment.gateways.authorize_net.plugin.authorize")
+def test_payment_gateway_authorize_payment(
+ mocked_authorize, authorize_net_plugin, dummy_payment_data
+):
+ mocked_authorize.return_value(None)
+ authorize_net_plugin.authorize_payment(dummy_payment_data, None)
+ mocked_authorize.assert_called_with(
+ dummy_payment_data, authorize_net_plugin._get_gateway_config()
+ )
+
+
[email protected]("saleor.payment.gateways.authorize_net.plugin.capture")
+def test_payment_gateway_capture_payment(
+ mocked_capture, authorize_net_plugin, dummy_payment_data
+):
+ mocked_capture.return_value(None)
+ authorize_net_plugin.capture_payment(dummy_payment_data, None)
+ mocked_capture.assert_called_with(
+ dummy_payment_data, authorize_net_plugin._get_gateway_config()
+ )
+
+
[email protected]("saleor.payment.gateways.authorize_net.plugin.process_payment")
+def test_payment_gateway_process_payment(
+ mocked_process_payment, authorize_net_plugin, dummy_payment_data
+):
+ mocked_process_payment.return_value = None
+ authorize_net_plugin.process_payment(dummy_payment_data, None)
+ mocked_process_payment.assert_called_with(
+ dummy_payment_data, authorize_net_plugin.config, None
+ )
+
+
[email protected]("saleor.payment.gateways.authorize_net.plugin.list_client_sources")
+def test_payment_gateway_list_payment_sources(
+ mocked_list_client_sources, authorize_net_plugin
+):
+ mocked_list_client_sources.return_value = []
+ sources = authorize_net_plugin.list_payment_sources("1", [])
+ assert sources == []
diff --git a/saleor/settings.py b/saleor/settings.py
index 858394d5b1..bf810fdfb8 100644
--- a/saleor/settings.py
+++ b/saleor/settings.py
@@ -523,6 +523,7 @@ PLUGINS = [
"saleor.payment.gateways.braintree.plugin.BraintreeGatewayPlugin",
"saleor.payment.gateways.razorpay.plugin.RazorpayGatewayPlugin",
"saleor.payment.gateways.adyen.plugin.AdyenGatewayPlugin",
+ "saleor.payment.gateways.authorize_net.plugin.AuthorizeNetGatewayPlugin",
"saleor.plugins.invoicing.plugin.InvoicingPlugin",
]