Skip to content

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

Fix import order, fix missing requirement and add gateway documentations

NyanKiyoshi8fd363f0d929
diff --git a/Pipfile b/Pipfile
index 7c144e92ef..255f01d12e 100644
--- a/Pipfile
+++ b/Pipfile
@@ -61,6 +61,7 @@ celery = {version = "*", extras = ["redis"]}
weasyprint = ">=0.42.2"
graphene-django-optimizer = "*"
braintree = "==3.49.0"
+razorpay = ">=1.1.1"
[dev-packages]
pytest = "*"
diff --git a/Pipfile.lock b/Pipfile.lock
index 6c90873151..b246cb6e3c 100644
--- a/Pipfile.lock
+++ b/Pipfile.lock
@@ -1,7 +1,7 @@
{
"_meta": {
"hash": {
- "sha256": "4553437c207ee782e2373bbab674f86af349d05b6eda1d1fe1fb5df38474ee3f"
+ "sha256": "ccf332313efa4f7f6a6cafdc4fedff2a892f95d0e414027fb243537950c367fd"
},
"pipfile-spec": 6,
"requires": {
@@ -60,18 +60,18 @@
},
"boto3": {
"hashes": [
- "sha256:177e9dd53db5028bb43050da20cc7956287889fc172e5e6275a634e42a10beeb",
- "sha256:8c63e616b91907037ab19236afbcf0057efb31411faf38b46f4590e634dc17ea"
+ "sha256:40872be3cab0e1078e97aa0cfa8d836841d4e0acf40f5a4e59c6c33eacaea321",
+ "sha256:cc189072a38250d79f61660e83c0af899ff45e9de5f05b0a54f3a8a27b87d153"
],
"index": "pypi",
- "version": "==1.9.50"
+ "version": "==1.9.51"
},
"botocore": {
"hashes": [
- "sha256:07fae5a2b8cfb5a92c1dbee3f2feb4da7c471bcead7e18ce735babe5f39e270f",
- "sha256:eeaa190f50ee05a56225ee78c64cb8bf0c3bf090ec605ca6c2f325aa3826a347"
+ "sha256:4209c43f6913470371bda03aea01c933247dc9592421eb1abf1fb9f594f60a35",
+ "sha256:ddbd84e0c8f9bd29f9f67e10089df87089d0f10a8a45e156c7d2def7707d0113"
],
- "version": "==1.12.50"
+ "version": "==1.12.51"
},
"braintree": {
"hashes": [
@@ -85,6 +85,7 @@
"hashes": [
"sha256:15386c3a9e08823d6826c4491eaccc7b7254b1dc587a3b9ce60c350c3f990337"
],
+ "markers": "python_version >= '2.7' and python_version != '3.1.*' and python_version != '3.0.*' and python_version != '3.3.*' and python_version != '3.2.*'",
"version": "==0.9.0"
},
"cairosvg": {
@@ -92,12 +93,10 @@
"sha256:93c5b3204478c4e20c4baeb33807db5311b4420c21db2f21034a6deda998cb14",
"sha256:f331e6024ee4c7f3eca3b0caa909dd893fa4d7414f50a6b206acbe2df20d95a9"
],
+ "markers": "python_version != '3.1.*' and python_version >= '2.7' and python_version != '3.0.*' and python_version != '3.3.*' and python_version != '3.2.*'",
"version": "==2.2.1"
},
"celery": {
- "extras": [
- "redis"
- ],
"hashes": [
"sha256:77dab4677e24dc654d42dfbdfed65fa760455b6bb563a0877ecc35f4cfcfc678",
"sha256:ad7a7411772b80a4d6c64f2f7f723200e39fb66cf614a7fdfab76d345acc7b13"
@@ -147,6 +146,7 @@
"sha256:edabd457cd23a02965166026fd9bfd196f4324fe6032e866d0f3bd0301cd486f",
"sha256:fdf1c1dc5bafc32bc5d08b054f94d659422b05aba244d6be4ddc1c72d9aa70fb"
],
+ "markers": "python_version >= '2.7' and python_version != '3.1.*' and python_version != '3.0.*' and python_version != '3.3.*' and python_version != '3.2.*'",
"version": "==1.11.5"
},
"chardet": {
@@ -176,7 +176,6 @@
"sha256:4aeaeb1f573c74835b0686a2b46b85990571159ffc21aa57ecd4d1e1cb334163",
"sha256:851785365761ebe4994a921b433062309eb882fedd318e1b0fcecc607ed02da9"
],
- "index": "pypi",
"version": "==0.5.0"
},
"dj-email-url": {
@@ -184,7 +183,6 @@
"sha256:84f32673156f58d740a14cab09f04ca92a65b2c8881b60e31e09e67d7853e544",
"sha256:de8e062c1483d1bfc7a9a185c6601f9c822087bd529756989f81f1dc82855cee"
],
- "index": "pypi",
"version": "==0.1.0"
},
"django": {
@@ -447,11 +445,11 @@
},
"google-i18n-address": {
"hashes": [
- "sha256:27de4f60a161f643632d886f18bd29309d7d5bb676b38378f523cd2d6f2013cb",
- "sha256:4737c1c16a7b67adf12875b7917c0a11bd3054a5bd30004b3b1544922fc485ad"
+ "sha256:68c1e5b65fe164c92adc483048abf7b57f2ba4298203495b8aeb02140fabb548",
+ "sha256:8aea5ccf75614bf5b789ff54f8531e8ef8fe30c7ea2d4fc17dd8a88202b71187"
],
"index": "pypi",
- "version": "==2.3.2"
+ "version": "==2.3.3"
},
"google-measurement-protocol": {
"hashes": [
@@ -557,6 +555,7 @@
"sha256:d02e0f9b04c500cde6637c11ad7c72671f359b87b9fe924b2383649d8841db7c"
],
"index": "pypi",
+ "markers": "python_version != '3.1.*' and python_version >= '2.7' and python_version != '3.0.*' and python_version != '3.3.*' and python_version != '3.2.*'",
"version": "==3.0.1"
},
"markupsafe": {
@@ -590,6 +589,7 @@
"sha256:f82e347a72f955b7017a39708a3667f106e6ad4d10b25f237396a7115d8ed5fd",
"sha256:fb7c206e01ad85ce57feeaaa0bf784b97fa3cad0d4a5737bc5295785f5c613a1"
],
+ "markers": "python_version >= '2.7' and python_version != '3.2.*' and python_version != '3.3.*' and python_version != '3.0.*' and python_version != '3.1.*'",
"version": "==1.1.0"
},
"maxminddb": {
@@ -666,6 +666,7 @@
"sha256:f52b79c8796d81391ab295b04e520bda6feed54d54931708872e8f9ae9db0ea1",
"sha256:ff8cff01582fa1a7e533cb97f628531c4014af4b5f38e33cdcfe5eec29b6d888"
],
+ "markers": "python_version >= '2.7' and python_version != '3.1.*' and python_version != '3.0.*' and python_version != '3.3.*' and python_version != '3.2.*'",
"version": "==5.3.0"
},
"prices": {
@@ -737,14 +738,15 @@
"hashes": [
"sha256:a988718abfad80b6b157acce7bf130a30876d27603738ac39f140993246b25b3"
],
+ "markers": "python_version >= '2.7' and python_version != '3.1.*' and python_version != '3.0.*' and python_version != '3.3.*' and python_version != '3.2.*'",
"version": "==2.19"
},
"pygments": {
"hashes": [
- "sha256:78f3f434bcc5d6ee09020f92ba487f95ba50f1e3ef83ae96b9d5ffa1bab25c5d",
- "sha256:dbae1046def0efb574852fab9e90209b23f556367b5a320c0bcb871c77c3e8cc"
+ "sha256:6301ecb0997a52d2d31385e62d0a4a4cf18d2f2da7054a5ddad5c366cd39cee7",
+ "sha256:82666aac15622bd7bb685a4ee7f6625dd716da3ef7473620c192c0168aae64fc"
],
- "version": "==2.2.0"
+ "version": "==2.3.0"
},
"pyjwt": {
"hashes": [
@@ -791,6 +793,13 @@
"index": "pypi",
"version": "==6.9.0"
},
+ "razorpay": {
+ "hashes": [
+ "sha256:100ff167880406a2aa604316e8a3e9b8598ed036cd3ef6c31707aa1689386680"
+ ],
+ "index": "pypi",
+ "version": "==1.1.1"
+ },
"redis": {
"hashes": [
"sha256:2100750629beff143b6a200a2ea8e719fcf26420adabb81402895e144c5083cf",
@@ -811,6 +820,7 @@
"sha256:8886bfec5ad7afb391ed5443b1f697c6f4ae98d0e5620839d8b4499c032ada3f",
"sha256:e21232e2465808c0e892e0e4dbb8c2faafec16ac6dc067dd546e9b466f3deac8"
],
+ "markers": "python_version >= '2.7' and python_version < '4' and python_version != '3.1.*' and python_version != '3.0.*' and python_version != '3.3.*' and python_version != '3.2.*'",
"version": "==1.0.0"
},
"rx": {
@@ -856,6 +866,7 @@
"sha256:b8a34e7eb71c66e4d68deb007c81d4f74d4e0bc52c1c4f871a7758db0a0c268e",
"sha256:cec8e0a2297a23c0e1cab21bbcfaf32c8378fdb98762f47e315bbc65c3a83c89"
],
+ "markers": "python_version >= '2.7' and python_version < '4' and python_version != '3.1.*' and python_version != '3.0.*' and python_version != '3.3.*' and python_version != '3.2.*'",
"version": "==2.0.0"
},
"sqlparse": {
@@ -912,6 +923,7 @@
},
"vine": {
"hashes": [
+ "sha256:52116d59bc45392af9fdd3b75ed98ae48a93e822cee21e5fda249105c59a7a72",
"sha256:6849544be74ec3638e84d90bc1cf2e1e9224cc10d96cd4383ec3f69e9bce077b"
],
"version": "==1.1.4"
@@ -938,20 +950,22 @@
"sha256:37228cda29411948b422fae072f57e31d3396d2ee1c9783775980ee9c9990af6",
"sha256:58587dd4dc3daefad0487f6d9ae32b4542b185e1c36db6993290e7c41ca2b47c"
],
+ "markers": "python_version >= '2.7' and python_version != '3.1.*' and python_version != '3.2.*' and python_version != '3.3.*' and python_version != '3.0.*'",
"version": "==1.5"
},
"astroid": {
"hashes": [
- "sha256:292fa429e69d60e4161e7612cb7cc8fa3609e2e309f80c224d93a76d5e7b58be",
- "sha256:c7013d119ec95eb626f7a2011f0b63d0c9a095df9ad06d8507b37084eada1a8d"
+ "sha256:35b032003d6a863f5dcd7ec11abd5cd5893428beaa31ab164982403bcb311f22",
+ "sha256:6a5d668d7dc69110de01cdf7aeec69a679ef486862a0850cc0fd5571505b6b7e"
],
- "version": "==2.0.4"
+ "version": "==2.1.0"
},
"atomicwrites": {
"hashes": [
"sha256:0312ad34fcad8fac3704d441f7b317e50af620823353ec657a53e981f92920c0",
"sha256:ec9ae8adaae229e4f8446952d204a3e4b5fdd2d099f9be3aaf556120135fb3ee"
],
+ "markers": "python_version >= '2.7' and python_version != '3.3.*' and python_version != '3.1.*' and python_version != '3.0.*' and python_version != '3.2.*'",
"version": "==1.2.1"
},
"attrs": {
@@ -1033,6 +1047,7 @@
"sha256:a7a84d5fa07a089186a329528f127c9d73b9de57f1a1131b82bb5320ee651f6a",
"sha256:fc155a6b553c66c838d1a22dba1dc9f5f505c43285a878c6f74a79c024750b83"
],
+ "markers": "python_version >= '2.7' and python_version != '3.1.*' and python_version != '3.2.*' and python_version != '3.3.*' and python_version != '3.0.*'",
"version": "==1.5.0"
},
"filelock": {
@@ -1139,6 +1154,7 @@
"sha256:daabc2766a2b76b3bec2086954c48d5f215f75a335eaee1e89c8357922a3c4d5",
"sha256:f08c1dcac70b558183b3b755b92f1135a76fd1caa04009b89ddea57a815599aa"
],
+ "markers": "python_version >= '3.4.1'",
"version": "==4.5.1"
},
"pluggy": {
@@ -1146,6 +1162,7 @@
"sha256:447ba94990e8014ee25ec853339faf7b0fc8050cdc3289d4d71f7f410fb90095",
"sha256:bde19360a8ec4dfd8a20dcb811780a30998101f078fc7ded6162f0076f50508f"
],
+ "markers": "python_version >= '2.7' and python_version != '3.1.*' and python_version != '3.2.*' and python_version != '3.3.*' and python_version != '3.0.*'",
"version": "==0.8.0"
},
"py": {
@@ -1153,6 +1170,7 @@
"sha256:bf92637198836372b520efcba9e020c330123be8ce527e535d185ed4b6f45694",
"sha256:e76826342cefe3c3d5f7e8ee4316b80d1dd8a300781612ddbc765c17ba25a6c6"
],
+ "markers": "python_version >= '2.7' and python_version != '3.1.*' and python_version != '3.2.*' and python_version != '3.3.*' and python_version != '3.0.*'",
"version": "==1.7.0"
},
"pycodestyle": {
@@ -1173,26 +1191,23 @@
},
"pylint": {
"hashes": [
- "sha256:1d6d3622c94b4887115fe5204982eee66fdd8a951cf98635ee5caee6ec98c3ec",
- "sha256:31142f764d2a7cd41df5196f9933b12b7ee55e73ef12204b648ad7e556c119fb"
+ "sha256:51f5a52bd31cb2db5b83ff37e3e902460eaa5591dea2739ba5d10d13ec5c5350",
+ "sha256:fe49f9ada5c8999344ac3a37541e329eaff11d014460065c4128fc94cf5cf140"
],
"index": "pypi",
- "version": "==2.1.1"
+ "version": "==2.2.0"
},
"pylint-celery": {
"hashes": [
"sha256:41e32094e7408d15c044178ea828dd524beedbdbe6f83f712c5e35bde1de4beb"
],
- "index": "pypi",
"version": "==0.3"
},
"pylint-django": {
"hashes": [
- "sha256:5dc5f85caef2c5f9e61622b9cbd89d94edd3dcf546939b2974d18de4fa90d676",
- "sha256:bf313f10b68ed915a34f0f475cc9ff8c7f574a95302beb48b79c5993f7efd84c"
+ "sha256:f2899a0f33c9bede0c9912ade9a57bbfc4b400b4912c59bea055353f9d2ff56f"
],
- "index": "pypi",
- "version": "==2.0.2"
+ "version": "==2.0.4"
},
"pylint-plugin-utils": {
"hashes": [
@@ -1203,11 +1218,11 @@
},
"pytest": {
"hashes": [
- "sha256:488c842647bbeb350029da10325cb40af0a9c7a2fdda45aeb1dda75b60048ffb",
- "sha256:c055690dfefa744992f563e8c3a654089a6aa5b8092dded9b6fafbd70b2e45a7"
+ "sha256:1d131cc532be0023ef8ae265e2a779938d0619bb6c2510f52987ffcba7fa1ee4",
+ "sha256:ca4761407f1acc85ffd1609f464ca20bb71a767803505bd4127d0e45c5a50e23"
],
"index": "pypi",
- "version": "==4.0.0"
+ "version": "==4.0.1"
},
"pytest-cov": {
"hashes": [
@@ -1230,6 +1245,7 @@
"sha256:e4500cd0509ec4a26535f7d4112a8cc0f17d3a41c29ffd4eab479d2a55b30805",
"sha256:f275cb48a73fc61a6710726348e1da6d68a978f0ec0c54ece5a5fae5977e5a08"
],
+ "markers": "python_version >= '2.7' and python_version != '3.1.*' and python_version != '3.2.*' and python_version != '3.3.*' and python_version != '3.0.*'",
"version": "==0.2"
},
"pytest-mock": {
@@ -1321,35 +1337,6 @@
"index": "pypi",
"version": "==0.13.5"
},
- "typed-ast": {
- "hashes": [
- "sha256:0948004fa228ae071054f5208840a1e88747a357ec1101c17217bfe99b299d58",
- "sha256:10703d3cec8dcd9eef5a630a04056bbc898abc19bac5691612acba7d1325b66d",
- "sha256:1f6c4bd0bdc0f14246fd41262df7dfc018d65bb05f6e16390b7ea26ca454a291",
- "sha256:25d8feefe27eb0303b73545416b13d108c6067b846b543738a25ff304824ed9a",
- "sha256:29464a177d56e4e055b5f7b629935af7f49c196be47528cc94e0a7bf83fbc2b9",
- "sha256:2e214b72168ea0275efd6c884b114ab42e316de3ffa125b267e732ed2abda892",
- "sha256:3e0d5e48e3a23e9a4d1a9f698e32a542a4a288c871d33ed8df1b092a40f3a0f9",
- "sha256:519425deca5c2b2bdac49f77b2c5625781abbaf9a809d727d3a5596b30bb4ded",
- "sha256:57fe287f0cdd9ceaf69e7b71a2e94a24b5d268b35df251a88fef5cc241bf73aa",
- "sha256:668d0cec391d9aed1c6a388b0d5b97cd22e6073eaa5fbaa6d2946603b4871efe",
- "sha256:68ba70684990f59497680ff90d18e756a47bf4863c604098f10de9716b2c0bdd",
- "sha256:6de012d2b166fe7a4cdf505eee3aaa12192f7ba365beeefaca4ec10e31241a85",
- "sha256:79b91ebe5a28d349b6d0d323023350133e927b4de5b651a8aa2db69c761420c6",
- "sha256:8550177fa5d4c1f09b5e5f524411c44633c80ec69b24e0e98906dd761941ca46",
- "sha256:898f818399cafcdb93cbbe15fc83a33d05f18e29fb498ddc09b0214cdfc7cd51",
- "sha256:94b091dc0f19291adcb279a108f5d38de2430411068b219f41b343c03b28fb1f",
- "sha256:a26863198902cda15ab4503991e8cf1ca874219e0118cbf07c126bce7c4db129",
- "sha256:a8034021801bc0440f2e027c354b4eafd95891b573e12ff0418dec385c76785c",
- "sha256:bc978ac17468fe868ee589c795d06777f75496b1ed576d308002c8a5756fb9ea",
- "sha256:c05b41bc1deade9f90ddc5d988fe506208019ebba9f2578c622516fd201f5863",
- "sha256:c9b060bd1e5a26ab6e8267fd46fc9e02b54eb15fffb16d112d4c7b1c12987559",
- "sha256:edb04bdd45bfd76c8292c4d9654568efaedf76fe78eb246dde69bdb13b2dad87",
- "sha256:f19f2a4f547505fe9072e15f6f4ae714af51b5a681a97f187971f50c283193b6"
- ],
- "markers": "python_version < '3.7' and implementation_name == 'cpython'",
- "version": "==1.1.0"
- },
"unidecode": {
"hashes": [
"sha256:092cdf7ad9d1052c50313426a625b717dab52f7ac58f859e09ea020953b1ad8f",
@@ -1370,6 +1357,7 @@
"sha256:127e79cf7b569d071d1bd761b83f7b62b2ce2a2eb63ceca7aa67cba8f2602ea3",
"sha256:57be64aa8e9883a4117d0b15de28af62275c001abcdb00b6dc2d4406073d9a4f"
],
+ "markers": "python_version >= '3.4.1'",
"version": "==2.0.1"
},
"virtualenv": {
@@ -1377,6 +1365,7 @@
"sha256:686176c23a538ecc56d27ed9d5217abd34644823d6391cbeb232f42bf722baad",
"sha256:f899fafcd92e1150f40c8215328be38ff24b519cd95357fa6e78e006c7638208"
],
+ "markers": "python_version != '3.0.*' and python_version != '3.1.*' and python_version != '3.3.*' and python_version != '3.2.*' and python_version >= '2.7'",
"version": "==16.1.0"
},
"wrapt": {
@@ -1387,11 +1376,11 @@
},
"yapf": {
"hashes": [
- "sha256:b96815bd0bbd2ab290f2ae9e610756940b17a0523ef2f6b2d31da749fc395137",
- "sha256:cebb6faf35c9027c08996c07831b8971f3d67c0eb615269f66dfd7e6815fdc2a"
+ "sha256:8aa7f9abdb97b4da4d3227306b88477982daafef0a96cc41639754ca31f46d55",
+ "sha256:f2df5891481f94ddadfbf8ae8ae499080752cfb06005a31bbb102f3012f8b944"
],
"index": "pypi",
- "version": "==0.24.0"
+ "version": "==0.25.0"
},
"yarl": {
"hashes": [
@@ -1405,7 +1394,7 @@
"sha256:f17495e6fe3d377e3faac68121caef6f974fcb9e046bc075bcff40d8e5cc69a4",
"sha256:f85900b9cca0c67767bb61b2b9bd53208aaa7373dae633dbe25d179b4bf38aa7"
],
- "markers": "python_version >= '3.4'",
+ "markers": "python_version >= '3.4.1'",
"version": "==1.2.6"
}
}
diff --git a/docs/architecture/payments.rst b/docs/architecture/payments.rst
index 33d7fb9358..355bc18bdf 100644
--- a/docs/architecture/payments.rst
+++ b/docs/architecture/payments.rst
@@ -1,25 +1,7 @@
-.. _payments:
+.. _payments-architecture:
-Payments
-========
-
-Supported Gateways
-------------------
-
-The default configuration uses the `dummy` backend.
-It's meant to allow developers to easily simulate different payment results.
-
-Supported payment gateways:
-^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-* Braintree (supports PayPal and Credit Cards)
-
-For how-to guide on adding new payments into your Saleor project please check :ref:`adding-payments`
-
-.. note::
-
- All payment backends default to using sandbox mode.
- This is very useful for development but make sure you use production mode when deploying to a production server.
+Payments Architecture
+=====================
Authorization and Capture
-------------------------
diff --git a/docs/gettingstarted/configuration.rst b/docs/gettingstarted/configuration.rst
index b4afb799fa..0ebdda662b 100644
--- a/docs/gettingstarted/configuration.rst
+++ b/docs/gettingstarted/configuration.rst
@@ -6,6 +6,11 @@ Configuration
We are fans of the `12factor <https://12factor.net/>`_ approach and portable code so you can configure most of Saleor using just environment variables.
+Payments Gateways
+-----------------
+For the configuration of the payment gateways, see :ref:`payment-gateways`.
+
+
Environment variables
---------------------
diff --git a/docs/guides/payments.rst b/docs/guides/payments.rst
index 20a7e9b1a3..a42815d60b 100644
--- a/docs/guides/payments.rst
+++ b/docs/guides/payments.rst
@@ -229,7 +229,7 @@ Handling errors
---------------
Gateway-specific errors should be parsed to Saleor's universal format.
-More on this can be found in :ref:`payments`.
+More on this can be found in :ref:`payments-architecture`.
Adding payment method to the old checkout (optional)
----------------------------------------------------
diff --git a/docs/index.rst b/docs/index.rst
index a643fe3240..d038216153 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -10,6 +10,7 @@ Contents:
gettingstarted
customization
+ payment-gateways
contributing
architecture
integrations
diff --git a/docs/payment-gateways.rst b/docs/payment-gateways.rst
new file mode 100644
index 0000000000..b9cf599726
--- /dev/null
+++ b/docs/payment-gateways.rst
@@ -0,0 +1,24 @@
+.. _payment-gateways:
+
+Supported Payment Gateways
+==========================
+
+Here is our list of supported payment gateways:
+
+.. toctree::
+ :maxdepth: 1
+
+ payment-gateways/braintree.rst
+ payment-gateways/razorpay.rst
+
+The default configuration uses the `dummy` backend.
+It's meant to allow developers to easily simulate different payment results.
+
+For an how-to guide on adding new payments into your Saleor project
+please check :ref:`adding-payments`.
+
+.. note::
+
+ All payment backends default to using sandbox mode.
+ This is very useful for development but make sure you use production mode when deploying to a production server.
+
diff --git a/docs/payment-gateways/braintree.rst b/docs/payment-gateways/braintree.rst
new file mode 100644
index 0000000000..e4ba121d3f
--- /dev/null
+++ b/docs/payment-gateways/braintree.rst
@@ -0,0 +1,20 @@
+Braintree (supports PayPal and Credit Cards)
+============================================
+
+This gateway implements payments using `Braintree <https://www.braintreepayments.com/>`_.
+
+.. table::
+
+ ========================== =================================================================================
+ Environment variable Description
+ ========================== =================================================================================
+ ``BRAINTREE_SANDBOX_MODE`` Whether to use a sandbox environment for testing, ``True`` (default) or ``False``
+ ``BRAINTREE_MERCHANT_ID`` Merchant ID assigned by Braintree
+ ``BRAINTREE_PUBLIC_KEY`` Public key assigned by Braintree
+ ``BRAINTREE_PRIVATE_KEY`` Private key assigned by Braintree
+ ========================== =================================================================================
+
+
+.. note::
+
+ This backend does not support fraud detection.
diff --git a/docs/payment-gateways/razorpay.rst b/docs/payment-gateways/razorpay.rst
new file mode 100644
index 0000000000..497d4abaa6
--- /dev/null
+++ b/docs/payment-gateways/razorpay.rst
@@ -0,0 +1,24 @@
+Razorpay (supports only the paisa currency)
+===========================================
+
+This gateway implements payments using `Razorpay <https://razorpay.com/>`_.
+
+First of all, to create your API credentials, you need to go in your Razorpay account settings,
+then in the `API Keys section <https://dashboard.razorpay.com/#/app/keys>`_.
+
+.. table::
+
+ ========================== =========================================================================
+ Environment variable Description
+ ========================== =========================================================================
+ ``RAZORPAY_PUBLIC_KEY`` Your Razorpay **key id**
+ ``RAZORPAY_SECRET_KEY`` Your Razorpay **secret key id**
+ ``RAZORPAY_PREFILL`` Pre-fill the email and customer's full name if set to ``True`` (default)
+ ``RAZORPAY_STORE_NAME`` Your store name
+ ``RAZORPAY_STORE_IMAGE`` An absolute or relative link to your store logo
+ ========================== =========================================================================
+
+
+.. warning::
+
+ Only the paisa (INR) currency is supported by Razorpay as of now.
diff --git a/requirements.txt b/requirements.txt
index c77e1b5f73..00b28c1f50 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -5,17 +5,17 @@ autopep8==1.4.3
babel==2.6.0
billiard==3.5.0.4
bleach==2.1.4
-boto3==1.9.50
-botocore==1.12.50
+boto3==1.9.51
+botocore==1.12.51
braintree==3.49.0
-cairocffi==0.9.0
-cairosvg==2.2.1
-celery[redis]==4.2.1
+cairocffi==0.9.0; python_version != '3.2.*'
+cairosvg==2.2.1; python_version != '3.2.*'
+celery==4.2.1
certifi==2018.10.15
-cffi==1.11.5
+cffi==1.11.5; python_version != '3.2.*'
chardet==3.0.4
cssselect2==0.2.1
-defusedxml==0.5.0 ; python_version >= '3.0'
+defusedxml==0.5.0; python_version >= '3.0'
dj-database-url==0.5.0
dj-email-url==0.1.0
django-appconf==1.0.2
@@ -52,7 +52,7 @@ elasticsearch-dsl==6.0.1
elasticsearch==6.0.0
faker==1.0.0
freezegun==0.3.11
-google-i18n-address==2.3.2
+google-i18n-address==2.3.3
google-measurement-protocol==1.0.0
gprof2dot==2016.10.13
graphene-django-optimizer==0.3.5
@@ -67,44 +67,45 @@ jinja2==2.10
jmespath==0.9.3
jsonfield==2.0.2
kombu==4.2.1
-markdown==3.0.1
-markupsafe==1.1.0
+markdown==3.0.1; python_version != '3.2.*'
+markupsafe==1.1.0; python_version != '3.1.*'
maxminddb-geolite2==2018.703
maxminddb==1.4.1
measurement==2.0.1
mpmath==1.0.0
oauthlib==2.1.0
phonenumberslite==8.10.0
-pillow==5.3.0
+pillow==5.3.0; python_version != '3.2.*'
prices==1.0.0
promise==2.2.1
psycopg2-binary==2.7.6.1
purl==1.4
pycodestyle==2.4.0
-pycparser==2.19
-pygments==2.2.0
+pycparser==2.19; python_version != '3.2.*'
+pygments==2.3.0
pyjwt==1.6.4
pyphen==0.9.5
-python-dateutil==2.7.5 ; python_version >= '2.7'
-python3-openid==3.1.0 ; python_version >= '3.0'
+python-dateutil==2.7.5; python_version >= '2.7'
+python3-openid==3.1.0; python_version >= '3.0'
pytz==2018.7
raven==6.9.0
+razorpay==1.1.1
redis==3.0.1
-requests-oauthlib==1.0.0
+requests-oauthlib==1.0.0; python_version != '3.2.*'
requests==2.20.1
rx==1.6.1
s3transfer==0.1.13
singledispatch==3.4.0.3
six==1.11.0
social-auth-app-django==3.1.0
-social-auth-core==2.0.0
+social-auth-core==2.0.0; python_version != '3.2.*'
sqlparse==0.2.4
sympy==1.3
text-unidecode==1.2
tinycss2==0.6.1
typing==3.6.6
-urllib3==1.22 ; python_version >= '3.4'
-uwsgi==2.0.17.1 ; platform_system != 'Windows'
+urllib3==1.22; python_version >= '3.4'
+uwsgi==2.0.17.1; platform_system != 'Windows'
vine==1.1.4
weasyprint==43
webencodings==0.5.1
diff --git a/requirements_dev.txt b/requirements_dev.txt
index d00bcff90c..a0bed31ab3 100644
--- a/requirements_dev.txt
+++ b/requirements_dev.txt
@@ -1,36 +1,36 @@
-i https://pypi.python.org/simple
-apipkg==1.5
-astroid==2.0.4
-atomicwrites==1.2.1
+apipkg==1.5; python_version != '3.0.*'
+astroid==2.1.0
+atomicwrites==1.2.1; python_version != '3.2.*'
attrs==18.2.0
certifi==2018.10.15
chardet==3.0.4
codecov==2.0.15
coverage==4.5.2
django-extensions==2.1.4
-execnet==1.5.0
+execnet==1.5.0; python_version != '3.0.*'
filelock==3.0.10
idna==2.7
isort==4.3.4
lazy-object-proxy==1.3.1
mccabe==0.6.1
more-itertools==4.3.0
-multidict==4.5.1
-pluggy==0.8.0
-py==1.7.0
+multidict==4.5.1; python_version >= '3.4.1'
+pluggy==0.8.0; python_version != '3.0.*'
+py==1.7.0; python_version != '3.0.*'
pycodestyle==2.4.0
pydocstyle==3.0.0
pylint-celery==0.3
-pylint-django==2.0.2
+pylint-django==2.0.4
pylint-plugin-utils==0.4
-pylint==2.1.1
+pylint==2.2.0
pytest-cov==2.6.0
pytest-django==3.4.4
-pytest-forked==0.2
+pytest-forked==0.2; python_version != '3.0.*'
pytest-mock==1.10.0
pytest-vcr==1.0.1
pytest-xdist==1.24.1
-pytest==4.0.0
+pytest==4.0.1
python-slugify==1.2.6
pyyaml==3.13
requests==2.20.1
@@ -39,11 +39,10 @@ snowballstemmer==1.2.1
toml==0.10.0
tox==3.5.3
transifex-client==0.13.5
-typed-ast==1.1.0 ; python_version < '3.7' and implementation_name == 'cpython'
unidecode==1.0.23
-urllib3==1.22 ; python_version >= '3.4'
-vcrpy==2.0.1
-virtualenv==16.1.0
+urllib3==1.22; python_version >= '3.4'
+vcrpy==2.0.1; python_version >= '3.4.1'
+virtualenv==16.1.0; python_version >= '2.7'
wrapt==1.10.11
-yapf==0.24.0
-yarl==1.2.6 ; python_version >= '3.4'
+yapf==0.25.0
+yarl==1.2.6; python_version >= '3.4.1'
diff --git a/saleor/payment/gateways/razorpay/__init__.py b/saleor/payment/gateways/razorpay/__init__.py
index 2596b87c27..ac84c88587 100644
--- a/saleor/payment/gateways/razorpay/__init__.py
+++ b/saleor/payment/gateways/razorpay/__init__.py
@@ -1,8 +1,8 @@
+import uuid
from decimal import Decimal
+from typing import Dict, Tuple
import razorpay
-import uuid
-from typing import Dict, Tuple
from ... import TransactionKind
from ...utils import create_transaction
@@ -18,7 +18,7 @@ def _generate_transaction(
payment, kind: str, amount=None,
*, id='', is_success=True, **data):
- if type(amount) is int:
+ if isinstance(amount, int):
amount = Decimal(amount) / 100
elif amount is None:
amount = payment.total
diff --git a/saleor/payment/gateways/razorpay/forms.py b/saleor/payment/gateways/razorpay/forms.py
index 526570e081..47fcdb3b45 100644
--- a/saleor/payment/gateways/razorpay/forms.py
+++ b/saleor/payment/gateways/razorpay/forms.py
@@ -1,4 +1,3 @@
-
from django import forms
from django.forms.utils import flatatt
from django.forms.widgets import HiddenInput
diff --git a/tests/gateway/test_razorpay.py b/tests/gateway/test_razorpay.py
index 4f2bf58d4c..b542fd7863 100644
--- a/tests/gateway/test_razorpay.py
+++ b/tests/gateway/test_razorpay.py
@@ -3,9 +3,19 @@ from unittest.mock import patch
import pytest
from django.conf import settings
-from saleor.payment import ChargeStatus, TransactionKind, PaymentError
+from saleor.payment import ChargeStatus, PaymentError, TransactionKind
from saleor.payment.gateways import razorpay
-from saleor.payment.gateways.razorpay.forms import RazorPayCheckoutWidget
+from saleor.payment.gateways.razorpay.forms import (
+ RazorPayCheckoutWidget, RazorPaymentForm)
+
+
+def mocked_gateway_client(razorpay_payment):
+ with patch('razorpay.Client') as mocked:
+ response = {'amount': int(razorpay_payment.total * 100)}
+ mocked().payment.capture.return_value = response
+ mocked().payment.refund.return_value = response
+ yield mocked
@pytest.fixture()
@@ -41,6 +51,10 @@ def test_checkout_widget_render_with_prefill(payment_dummy):
'src="https://checkout.razorpay.com/v1/checkout.js"></script>')
+def test_gateway_get_form_class():
+ assert razorpay.get_form_class() == RazorPaymentForm
+
+
def test_gateway_void(razorpay_payment):
txn = razorpay_payment.void()
razorpay_payment.refresh_from_db()
@@ -51,7 +65,6 @@ def test_gateway_void(razorpay_payment):
assert not razorpay_payment.is_active
[email protected](razorpay, 'get_client')
def test_gateway_charge(mocked_gateway_client, razorpay_payment):
capture_txn = razorpay_payment.charge(payment_token='token')
@@ -69,7 +82,6 @@ def test_gateway_charge(mocked_gateway_client, razorpay_payment):
assert razorpay_payment.is_active
[email protected](razorpay, 'get_client')
def test_refund_success(mocked_gateway_client, razorpay_payment):
razorpay_payment.captured_amount = razorpay_payment.total
razorpay_payment.charge_status = ChargeStatus.CHARGED
@@ -84,18 +96,19 @@ def test_refund_success(mocked_gateway_client, razorpay_payment):
txn = razorpay_payment.refund()
razorpay_payment.refresh_from_db()
+ mocked_gateway_client().payment.refund.assert_called_once_with(
+ razorpay_payment.token, int(razorpay_payment.total * 100))
+
assert txn.payment == razorpay_payment
assert txn.kind == TransactionKind.REFUND
+ assert txn.amount == razorpay_payment.total
assert txn.is_success
- mocked_gateway_client().payment.refund.assert_called_once_with(
- razorpay_payment.token, int(razorpay_payment.total * 100))
assert razorpay_payment.charge_status == ChargeStatus.FULLY_REFUNDED
assert not razorpay_payment.captured_amount
assert not razorpay_payment.is_active
[email protected](razorpay, 'get_client')
def test_refund_failed(mocked_gateway_client, razorpay_payment):
razorpay_payment.captured_amount = razorpay_payment.total
razorpay_payment.charge_status = ChargeStatus.CHARGED