From 53262c7c2d9b3c8e88fe004f1c41bc19034b7bbb Mon Sep 17 00:00:00 2001 From: David Zhang Date: Tue, 21 Jul 2020 13:13:40 -0400 Subject: [PATCH 01/19] add stub for missing assets endpoint --- go/server.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/go/server.go b/go/server.go index 15629a9f..77bcf2af 100644 --- a/go/server.go +++ b/go/server.go @@ -315,6 +315,10 @@ func linkTokenCreate( return resp.LinkToken, nil } +func assets(c *gin.Context) { + c.JSON(http.StatusBadRequest, gin.H{"error": "unfortunate the go client library does not support assets report creation yet."}) +} + func main() { if APP_PORT == "" { APP_PORT = "8000" @@ -356,6 +360,7 @@ func main() { r.POST("/api/create_link_token", createLinkToken) r.GET("/api/investment_transactions", investmentTransactions) r.GET("/api/holdings", holdings) + r.GET("/api/assets", assets) err := r.Run(":" + APP_PORT) if err != nil { From e654218e370e33508f79b7c8825b217dc1bda270 Mon Sep 17 00:00:00 2001 From: David Zhang Date: Tue, 21 Jul 2020 13:20:21 -0400 Subject: [PATCH 02/19] fix major version for python --- python/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/requirements.txt b/python/requirements.txt index a27cab17..9b8a288a 100644 --- a/python/requirements.txt +++ b/python/requirements.txt @@ -6,4 +6,4 @@ click==6.7 itsdangerous==0.24 requests==2.20.0 wsgiref==0.1.2 ; python_version < '3.2' -plaid-python>=3.0.0 +plaid-python>=5.0.0, < 6.0.0 From b8ae678a2e59624d199c67cfd993f2d83fe17b03 Mon Sep 17 00:00:00 2001 From: David Zhang Date: Tue, 21 Jul 2020 13:24:52 -0400 Subject: [PATCH 03/19] do not use npm.plaid.com --- node/package-lock.json | 203 +++++++++-------------------------------- 1 file changed, 43 insertions(+), 160 deletions(-) diff --git a/node/package-lock.json b/node/package-lock.json index 6144c4e7..6861c5ef 100644 --- a/node/package-lock.json +++ b/node/package-lock.json @@ -6,26 +6,26 @@ "dependencies": { "@types/node": { "version": "9.6.56", - "resolved": "https://npm.plaid.com/@/@types/node/_attachments/node-9.6.56.tgz", + "resolved": "https://registry.npmjs.org/@types/node/-/node-9.6.56.tgz", "integrity": "sha512-Cq4pUCsBL6H7X0HFAOap75lmQqcnSmUDSP0R03lz9UsxRvBu5QsnKLLgIoitlFBX+j6LmciWYQAbOSmGMi7vwA==" }, "accepts": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz", - "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", + "version": "1.3.7", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", + "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", "requires": { - "mime-types": "~2.1.18", - "negotiator": "0.6.1" + "mime-types": "~2.1.24", + "negotiator": "0.6.2" } }, "array-flatten": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" }, "axios": { "version": "0.19.2", - "resolved": "https://npm.plaid.com/a/axios/_attachments/axios-0.19.2.tgz", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz", "integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==", "requires": { "follow-redirects": "1.5.10" @@ -33,7 +33,7 @@ }, "bluebird": { "version": "3.7.2", - "resolved": "https://npm.plaid.com/b/bluebird/_attachments/bluebird-3.7.2.tgz", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==" }, "body-parser": { @@ -163,81 +163,6 @@ "vary": "~1.1.2" }, "dependencies": { - "body-parser": { - "version": "1.18.3", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz", - "integrity": "sha1-WykhmP/dVTs6DyDe0FkrlWlVyLQ=", - "requires": { - "bytes": "3.0.0", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "~1.1.2", - "http-errors": "~1.6.3", - "iconv-lite": "0.4.23", - "on-finished": "~2.3.0", - "qs": "6.5.2", - "raw-body": "2.3.3", - "type-is": "~1.6.16" - } - }, - "bytes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", - "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=" - }, - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, - "http-errors": { - "version": "1.6.3", - "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", - "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", - "requires": { - "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.0", - "statuses": ">= 1.4.0 < 2" - } - }, - "iconv-lite": { - "version": "0.4.23", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", - "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, - "qs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" - }, - "raw-body": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz", - "integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==", - "requires": { - "bytes": "3.0.0", - "http-errors": "1.6.3", - "iconv-lite": "0.4.23", - "unpipe": "1.0.0" - } - }, - "setprototypeof": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", - "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" - }, "statuses": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", @@ -247,7 +172,7 @@ }, "finalhandler": { "version": "1.1.1", - "resolved": "http://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.1.tgz", "integrity": "sha512-Y1GUDo39ez4aHAw7MysnUD5JzYX+WaIj8I57kO3aEPT1fFRL4sr7mjei97FgnwhAyyzRYmQZaTHb2+9uZ1dPtg==", "requires": { "debug": "2.6.9", @@ -259,19 +184,6 @@ "unpipe": "~1.0.0" }, "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, "statuses": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", @@ -281,7 +193,7 @@ }, "follow-redirects": { "version": "1.5.10", - "resolved": "https://npm.plaid.com/f/follow-redirects/_attachments/follow-redirects-1.5.10.tgz", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", "requires": { "debug": "=3.1.0" @@ -289,7 +201,7 @@ "dependencies": { "debug": { "version": "3.1.0", - "resolved": "https://npm.plaid.com/d/debug/_attachments/debug-3.1.0.tgz", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", "requires": { "ms": "2.0.0" @@ -309,7 +221,7 @@ }, "http-errors": { "version": "1.6.3", - "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", "requires": { "depd": "~1.1.2", @@ -332,13 +244,13 @@ "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, "ipaddr.js": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz", - "integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4=" + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" }, "media-typer": { "version": "0.3.0", - "resolved": "http://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" }, "merge-descriptors": { @@ -357,16 +269,16 @@ "integrity": "sha512-KI1+qOZu5DcW6wayYHSzR/tXKCDC5Om4s1z2QJjDULzLcmf3DvzS7oluY4HCTrc+9FiKmWUgeNLg7W3uIQvxtQ==" }, "mime-db": { - "version": "1.37.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.37.0.tgz", - "integrity": "sha512-R3C4db6bgQhlIhPU48fUtdVmKnflq+hRdad7IyKhtFj06VPNVdk2RhiYL3UjQIlso8L+YxAtFkobT0VK+S/ybg==" + "version": "1.44.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz", + "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg==" }, "mime-types": { - "version": "2.1.21", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.21.tgz", - "integrity": "sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg==", + "version": "2.1.27", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz", + "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==", "requires": { - "mime-db": "~1.37.0" + "mime-db": "1.44.0" } }, "moment": { @@ -380,9 +292,9 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, "negotiator": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz", - "integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk=" + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", + "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" }, "on-finished": { "version": "2.3.0", @@ -393,9 +305,9 @@ } }, "parseurl": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.2.tgz", - "integrity": "sha1-/CidTtiZMRlGDBViUyYs3I3mW/M=" + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" }, "path-to-regexp": { "version": "0.1.7", @@ -404,7 +316,7 @@ }, "plaid": { "version": "6.0.0", - "resolved": "https://npm.plaid.com/p/plaid/_attachments/plaid-6.0.0.tgz", + "resolved": "https://registry.npmjs.org/plaid/-/plaid-6.0.0.tgz", "integrity": "sha512-RanHJPSGQoIfQNIGmTYZOPxsrSjwuGucNTkz1T+BUIL/Q9QbEoFKgL+rLF4AhQAL8/AxZy+2AToF7yiR25k5ag==", "requires": { "@types/node": "9.x", @@ -414,12 +326,12 @@ } }, "proxy-addr": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz", - "integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz", + "integrity": "sha512-dh/frvCBVmSsDYzw6n926jv974gddhkFPfiN8hPOi30Wax25QZyZEGveluCgliBnqmuM+UJmBErbAUFIoDbjOw==", "requires": { "forwarded": "~0.1.2", - "ipaddr.js": "1.8.0" + "ipaddr.js": "1.9.1" } }, "qs": { @@ -429,13 +341,13 @@ }, "ramda": { "version": "0.23.0", - "resolved": "https://npm.plaid.com/r/ramda/_attachments/ramda-0.23.0.tgz", + "resolved": "https://registry.npmjs.org/ramda/-/ramda-0.23.0.tgz", "integrity": "sha1-zNE//3NJepOXTj6GMnv9h71ujis=" }, "range-parser": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", - "integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4=" + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==" }, "raw-body": { "version": "2.3.3", @@ -478,35 +390,6 @@ "statuses": "~1.4.0" }, "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, - "http-errors": { - "version": "1.6.3", - "resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz", - "integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=", - "requires": { - "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.0", - "statuses": ">= 1.4.0 < 2" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, - "setprototypeof": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz", - "integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ==" - }, "statuses": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", @@ -536,12 +419,12 @@ "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" }, "type-is": { - "version": "1.6.16", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.16.tgz", - "integrity": "sha512-HRkVv/5qY2G6I8iab9cI7v1bOIdhm94dVjQCPFElW9W+3GeDOSHmy2EBYe4VTApuzolPcmgFTN3ftVJRKR2J9Q==", + "version": "1.6.18", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", + "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", "requires": { "media-typer": "0.3.0", - "mime-types": "~2.1.18" + "mime-types": "~2.1.24" } }, "unpipe": { From ed790a983671bc329d9e7770d1ae7ba78f41c9c0 Mon Sep 17 00:00:00 2001 From: David Zhang Date: Tue, 21 Jul 2020 13:26:11 -0400 Subject: [PATCH 04/19] pin ruby to major version --- ruby/Gemfile | 2 +- ruby/Gemfile.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ruby/Gemfile b/ruby/Gemfile index a13d8199..f15bd8c3 100644 --- a/ruby/Gemfile +++ b/ruby/Gemfile @@ -1,4 +1,4 @@ source 'https://rubygems.org' -gem 'plaid' +gem 'plaid', '~>11.0.0' gem 'sinatra' diff --git a/ruby/Gemfile.lock b/ruby/Gemfile.lock index dd54f747..e65e6bac 100644 --- a/ruby/Gemfile.lock +++ b/ruby/Gemfile.lock @@ -28,7 +28,7 @@ PLATFORMS ruby DEPENDENCIES - plaid + plaid (~> 11.0.0) sinatra BUNDLED WITH From 9f3b022ea0ef5c2ec41f12a4716a21132d4e11fd Mon Sep 17 00:00:00 2001 From: David Zhang Date: Wed, 22 Jul 2020 09:17:34 -0400 Subject: [PATCH 05/19] quickstart polishing. --- .env | 3 + docker-compose.yml | 15 +-- go/server.go | 47 +++++--- html/index.html | 52 ++++----- java/dependency-reduced-pom.xml | 104 ------------------ java/pom.xml | 6 + .../quickstart/QuickstartApplication.java | 10 +- .../InvestmentTransactionsResource.java | 3 +- .../{ => resources}/LinkTokenResource.java | 14 ++- .../LinkTokenWithPaymentResource.java | 17 +-- python/server.py | 10 +- ruby/app.rb | 15 ++- 12 files changed, 121 insertions(+), 175 deletions(-) create mode 100644 .env delete mode 100644 java/dependency-reduced-pom.xml rename java/src/main/java/com/plaid/quickstart/{ => resources}/LinkTokenResource.java (78%) rename java/src/main/java/com/plaid/quickstart/{ => resources}/LinkTokenWithPaymentResource.java (86%) diff --git a/.env b/.env new file mode 100644 index 00000000..22fa05b4 --- /dev/null +++ b/.env @@ -0,0 +1,3 @@ +PLAID_PRODUCTS=transactions +PLAID_COUNTRY_CODES=US,CA +PLAID_REDIRECT_URI= diff --git a/docker-compose.yml b/docker-compose.yml index 10940505..1fad39ea 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,10 +1,11 @@ version: "3.4" x-environment: &QUICKSTART_ENVIRONMENT + # These are read from .env file. The values in the .env file maybe overriden by shell envvars PLAID_CLIENT_ID: ${PLAID_CLIENT_ID} PLAID_SECRET: ${PLAID_SECRET} - PLAID_PRODUCTS: transactions - PLAID_COUNTRY_CODES: US,CA - PLAID_REDIRECT_URI: + PLAID_PRODUCTS: ${PLAID_PRODUCTS} + PLAID_COUNTRY_CODES: ${PLAID_COUNTRY_CODES} + PLAID_REDIRECT_URI: ${PLAID_REDIRECT_URI} services: go: build: @@ -14,28 +15,28 @@ services: environment: << : *QUICKSTART_ENVIRONMENT java: - build: + build: context: . dockerfile: ./java/Dockerfile ports: ["8000:8000"] environment: << : *QUICKSTART_ENVIRONMENT node: - build: + build: context: . dockerfile: ./node/Dockerfile ports: ["8000:8000"] environment: << : *QUICKSTART_ENVIRONMENT python: - build: + build: context: . dockerfile: ./python/Dockerfile ports: ["8000:8000"] environment: << : *QUICKSTART_ENVIRONMENT ruby: - build: + build: context: . dockerfile: ./ruby/Dockerfile ports: ["8000:8000"] diff --git a/go/server.go b/go/server.go index 77bcf2af..d3faa206 100644 --- a/go/server.go +++ b/go/server.go @@ -61,11 +61,20 @@ var itemID string var paymentID string +func renderError(c *gin.Context, err error) { + if plaidError, ok := err.(plaid.Error); ok { + // Return 200 and allow the front end to render the error. + c.JSON(http.StatusOK, gin.H{"error": plaidError}) + return + } + c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) +} + func getAccessToken(c *gin.Context) { publicToken := c.PostForm("public_token") response, err := client.ExchangePublicToken(publicToken) if err != nil { - c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) + renderError(c, err) return } accessToken = response.AccessToken @@ -96,7 +105,7 @@ func createLinkTokenForPayment(c *gin.Context) { Country: "GB", }) if err != nil { - c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + renderError(c, err) return } paymentCreateResp, err := client.CreatePayment(recipientCreateResp.RecipientID, "payment-ref", plaid.PaymentAmount{ @@ -104,17 +113,17 @@ func createLinkTokenForPayment(c *gin.Context) { Value: 12.34, }) if err != nil { - c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + renderError(c, err) return } paymentID = paymentCreateResp.PaymentID fmt.Println("payment id: " + paymentID) - linkToken, httpErr := linkTokenCreate(&plaid.PaymentInitiation{ + linkToken, tokenCreateErr := linkTokenCreate(&plaid.PaymentInitiation{ PaymentID: paymentID, }) - if httpErr != nil { - c.JSON(httpErr.errorCode, gin.H{"error": httpErr.Error()}) + if tokenCreateErr != nil { + renderError(c, tokenCreateErr) } c.JSON(http.StatusOK, gin.H{ "link_token": linkToken, @@ -124,7 +133,7 @@ func createLinkTokenForPayment(c *gin.Context) { func auth(c *gin.Context) { response, err := client.GetAuth(accessToken) if err != nil { - c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + renderError(c, err) return } @@ -137,7 +146,7 @@ func auth(c *gin.Context) { func accounts(c *gin.Context) { response, err := client.GetAccounts(accessToken) if err != nil { - c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + renderError(c, err) return } @@ -149,7 +158,7 @@ func accounts(c *gin.Context) { func balance(c *gin.Context) { response, err := client.GetBalances(accessToken) if err != nil { - c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + renderError(c, err) return } @@ -161,13 +170,13 @@ func balance(c *gin.Context) { func item(c *gin.Context) { response, err := client.GetItem(accessToken) if err != nil { - c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + renderError(c, err) return } institution, err := client.GetInstitutionByID(response.Item.InstitutionID) if err != nil { - c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + renderError(c, err) return } @@ -180,7 +189,7 @@ func item(c *gin.Context) { func identity(c *gin.Context) { response, err := client.GetIdentity(accessToken) if err != nil { - c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + renderError(c, err) return } @@ -197,7 +206,7 @@ func transactions(c *gin.Context) { response, err := client.GetTransactions(accessToken, startDate, endDate) if err != nil { - c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + renderError(c, err) return } @@ -212,7 +221,7 @@ func transactions(c *gin.Context) { func payment(c *gin.Context) { response, err := client.GetPayment(paymentID) if err != nil { - c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + renderError(c, err) return } @@ -225,8 +234,9 @@ func investmentTransactions(c *gin.Context) { endDate := time.Now().Local().Format("2006-01-02") startDate := time.Now().Local().Add(-30 * 24 * time.Hour).Format("2006-01-02") response, err := client.GetInvestmentTransactions(accessToken, startDate, endDate) + fmt.Println("error", err) if err != nil { - c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + renderError(c, err) return } @@ -238,7 +248,7 @@ func investmentTransactions(c *gin.Context) { func holdings(c *gin.Context) { response, err := client.GetHoldings(accessToken) if err != nil { - c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + renderError(c, err) return } @@ -260,7 +270,7 @@ func createPublicToken(c *gin.Context) { // This public_token can be used to initialize Link in update mode for a user publicToken, err := client.CreatePublicToken(accessToken) if err != nil { - c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) + renderError(c, err) return } @@ -272,7 +282,8 @@ func createPublicToken(c *gin.Context) { func createLinkToken(c *gin.Context) { linkToken, err := linkTokenCreate(nil) if err != nil { - c.JSON(err.errorCode, gin.H{"error": err.error}) + renderError(c, err) + return } c.JSON(http.StatusOK, gin.H{"link_token": linkToken}) } diff --git a/html/index.html b/html/index.html index 7e0ba20b..e93130b2 100644 --- a/html/index.html +++ b/html/index.html @@ -317,7 +317,7 @@

Item management

} var accessToken = qs('access_token'); - if (accessToken != null && accessToken != '') { + if (accessToken != null && accessToken !== '') { $.post('/api/set_access_token', { access_token: accessToken }, function(data) { @@ -374,7 +374,7 @@

Item management

data.numbers.ach.forEach(function(achNumbers, idx) { // Find the account associated with this set of account and routing numbers var account = data.accounts.filter(function(a) { - return a.account_id == achNumbers.account_id; + return a.account_id === achNumbers.account_id; })[0]; html += ''; html += '' + account.name + ''; @@ -387,7 +387,7 @@

Item management

data.numbers.eft.forEach(function(eftNumber, idx) { // Find the account associated with this set of account and routing numbers var account = data.accounts.filter(function(a) { - return a.account_id == eftNumber.account_id; + return a.account_id === eftNumber.account_id; })[0]; html += ''; html += '' + account.name + ''; @@ -444,16 +444,16 @@

Item management

$('#get-item-btn').on('click', function(e) { $.get('/api/item', function(data) { $('#get-item-data').slideUp(function() { - if (data.error) { + if (data.error != null) { displayError(this, data.error); - } else { - var html = ''; - html += 'Institution name' + data.institution.name + ''; - html += 'Billed products' + data.item.billed_products.join(', ') + ''; - html += 'Available products' + data.item.available_products.join(', ') + ''; - - $(this).html(html).slideDown(); + return; } + var html = ''; + html += 'Institution name' + data.institution.name + ''; + html += 'Billed products' + data.item.billed_products.join(', ') + ''; + html += 'Available products' + data.item.available_products.join(', ') + ''; + + $(this).html(html).slideDown(); }); }); }); @@ -480,22 +480,22 @@

Item management

$(this).html(errorHtml).slideDown(); }); }); - } else { - $('#get-transactions-data').slideUp(function() { - var html = 'NameAmountDate'; - data.transactions.forEach(function(txn, idx) { - html += ''; - html += '' + txn.name + ''; - html += '$' + txn.amount + ''; - html += '' + txn.date + ''; - html += ''; - }); + return; + } + $('#get-transactions-data').slideUp(function () { + var html = 'NameAmountDate'; + data.transactions.forEach(function (txn, idx) { + html += ''; + html += '' + txn.name + ''; + html += '$' + txn.amount + ''; + html += '' + txn.date + ''; + html += ''; + }); - $(this).slideUp(function() { - $(this).html(html).slideDown(); - }); + $(this).slideUp(function () { + $(this).html(html).slideDown(); }); - } + }); }); }); @@ -640,7 +640,7 @@

Item management

}); }); }); - }; + } $.post('/api/info', {}, function(result) { render_page(jQuery, result); }); diff --git a/java/dependency-reduced-pom.xml b/java/dependency-reduced-pom.xml deleted file mode 100644 index 348253ae..00000000 --- a/java/dependency-reduced-pom.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - 4.0.0 - com.plaid - quickstart - Quickstart - 1.0-SNAPSHOT - - 3.0.0 - - - - - maven-shade-plugin - 2.4.3 - - - package - - shade - - - - - true - - - - ${mainClass} - - - - - - maven-jar-plugin - 3.0.2 - - - - true - ${mainClass} - - - - - - maven-compiler-plugin - 3.6.1 - - 1.8 - 1.8 - - - - maven-source-plugin - 3.0.1 - - - attach-sources - - jar - - - - - - - - - - maven-project-info-reports-plugin - 2.8.1 - - false - false - - - - maven-javadoc-plugin - 2.10.3 - - - - - - - io.dropwizard - dropwizard-bom - ${dropwizard.version} - pom - import - - - - - 1.3.2 - com.plaid.quickstart.QuickstartApplication - UTF-8 - UTF-8 - 1.8 - 1.8 - - - diff --git a/java/pom.xml b/java/pom.xml index dc2496c7..7d8b5ce7 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -71,6 +71,12 @@ jaxb-impl 2.2.11 + + + javax.activation + activation + 1.1.1 + diff --git a/java/src/main/java/com/plaid/quickstart/QuickstartApplication.java b/java/src/main/java/com/plaid/quickstart/QuickstartApplication.java index 6336c805..24a2018f 100644 --- a/java/src/main/java/com/plaid/quickstart/QuickstartApplication.java +++ b/java/src/main/java/com/plaid/quickstart/QuickstartApplication.java @@ -11,6 +11,8 @@ import com.plaid.quickstart.resources.InfoResource; import com.plaid.quickstart.resources.InvestmentTransactionsResource; import com.plaid.quickstart.resources.ItemResource; +import com.plaid.quickstart.resources.LinkTokenResource; +import com.plaid.quickstart.resources.LinkTokenWithPaymentResource; import com.plaid.quickstart.resources.PaymentInitiationResource; import com.plaid.quickstart.resources.PublicTokenResource; import com.plaid.quickstart.resources.TransactionsResource; @@ -68,6 +70,10 @@ public void run(final QuickstartConfiguration configuration, .build(); List plaidProducts = Arrays.asList(configuration.getPlaidProducts().split(",")); List countryCodes = Arrays.asList(configuration.getPlaidCountryCodes().split(",")); + String redirectUri = null; + if (configuration.getPlaidRedirectUri() != null && configuration.getPlaidRedirectUri().length() > 0) { + redirectUri = configuration.getPlaidRedirectUri(); + } environment.jersey().register(new AccessTokenResource(plaidClient)); environment.jersey().register(new AccountsResource(plaidClient)); environment.jersey().register(new AuthResource(plaidClient)); @@ -77,8 +83,8 @@ public void run(final QuickstartConfiguration configuration, environment.jersey().register(new InfoResource(plaidProducts)); environment.jersey().register(new InvestmentTransactionsResource(plaidClient)); environment.jersey().register(new ItemResource(plaidClient)); - environment.jersey().register(new LinkTokenResource(plaidClient, plaidProducts, countryCodes)); - environment.jersey().register(new LinkTokenWithPaymentResource(plaidClient, plaidProducts, countryCodes)); + environment.jersey().register(new LinkTokenResource(plaidClient, plaidProducts, countryCodes, redirectUri)); + environment.jersey().register(new LinkTokenWithPaymentResource(plaidClient, plaidProducts, countryCodes, redirectUri)); environment.jersey().register(new PaymentInitiationResource(plaidClient)); environment.jersey().register(new PublicTokenResource(plaidClient)); environment.jersey().register(new TransactionsResource(plaidClient)); diff --git a/java/src/main/java/com/plaid/quickstart/resources/InvestmentTransactionsResource.java b/java/src/main/java/com/plaid/quickstart/resources/InvestmentTransactionsResource.java index 44f1ba89..679c1270 100644 --- a/java/src/main/java/com/plaid/quickstart/resources/InvestmentTransactionsResource.java +++ b/java/src/main/java/com/plaid/quickstart/resources/InvestmentTransactionsResource.java @@ -31,11 +31,10 @@ public InvestmentTransactionsResponse getAccounts() throws IOException { new InvestmentsTransactionsGetRequest(QuickstartApplication.accessToken, startDate, endDate)) .execute(); - return new InvestmentTransactionsResponse(accountsResponse.body()); } - private class InvestmentTransactionsResponse { + private static class InvestmentTransactionsResponse { @JsonProperty private InvestmentsTransactionsGetResponse investmentTransactions; diff --git a/java/src/main/java/com/plaid/quickstart/LinkTokenResource.java b/java/src/main/java/com/plaid/quickstart/resources/LinkTokenResource.java similarity index 78% rename from java/src/main/java/com/plaid/quickstart/LinkTokenResource.java rename to java/src/main/java/com/plaid/quickstart/resources/LinkTokenResource.java index 752329b3..28153fa2 100644 --- a/java/src/main/java/com/plaid/quickstart/LinkTokenResource.java +++ b/java/src/main/java/com/plaid/quickstart/resources/LinkTokenResource.java @@ -1,4 +1,4 @@ -package com.plaid.quickstart; +package com.plaid.quickstart.resources; import com.fasterxml.jackson.annotation.JsonProperty; import com.plaid.client.PlaidClient; @@ -18,12 +18,14 @@ public class LinkTokenResource { private final PlaidClient plaidClient; private final List plaidProducts; private final List countryCodes; + private final String redirectUri; public LinkTokenResource(PlaidClient plaidClient, List plaidProducts, - List countryCodes) { + List countryCodes, String redirectUri) { this.plaidClient = plaidClient; this.plaidProducts = plaidProducts; this.countryCodes = countryCodes; + this.redirectUri = redirectUri; } public static class LinkToken { @@ -37,13 +39,13 @@ public LinkToken(String linkToken) { @POST public LinkToken getLinkToken() throws IOException { Response response = - plaidClient.service().linkTokenCreate(new LinkTokenCreateRequest( + this.plaidClient.service().linkTokenCreate(new LinkTokenCreateRequest( new LinkTokenCreateRequest.User("user-id"), - "my client name", - plaidProducts, + "Plaid Quickstart", + this.plaidProducts, this.countryCodes, "en" - )).execute(); + ).withRedirectUri(this.redirectUri)).execute(); return new LinkToken(response.body().getLinkToken()); } } diff --git a/java/src/main/java/com/plaid/quickstart/LinkTokenWithPaymentResource.java b/java/src/main/java/com/plaid/quickstart/resources/LinkTokenWithPaymentResource.java similarity index 86% rename from java/src/main/java/com/plaid/quickstart/LinkTokenWithPaymentResource.java rename to java/src/main/java/com/plaid/quickstart/resources/LinkTokenWithPaymentResource.java index 555e4757..3df483e2 100644 --- a/java/src/main/java/com/plaid/quickstart/LinkTokenWithPaymentResource.java +++ b/java/src/main/java/com/plaid/quickstart/resources/LinkTokenWithPaymentResource.java @@ -1,6 +1,5 @@ -package com.plaid.quickstart; +package com.plaid.quickstart.resources; -import com.fasterxml.jackson.annotation.JsonProperty; import com.plaid.client.PlaidClient; import com.plaid.client.model.paymentinitiation.Address; import com.plaid.client.model.paymentinitiation.Amount; @@ -10,6 +9,7 @@ import com.plaid.client.response.LinkTokenCreateResponse; import com.plaid.client.response.paymentinitiation.PaymentCreateResponse; import com.plaid.client.response.paymentinitiation.RecipientCreateResponse; +import com.plaid.quickstart.QuickstartApplication; import java.io.IOException; import java.util.Arrays; import java.util.List; @@ -25,12 +25,14 @@ public class LinkTokenWithPaymentResource { private final PlaidClient plaidClient; private final List plaidProducts; private final List countryCodes; + private final String redirectUri; public LinkTokenWithPaymentResource(PlaidClient plaidClient, List plaidProducts, - List countryCodes) { + List countryCodes, String redirectUri) { this.plaidClient = plaidClient; this.plaidProducts = plaidProducts; this.countryCodes = countryCodes; + this.redirectUri = redirectUri; } @POST public LinkTokenResource.LinkToken getLinkToken() throws IOException { @@ -55,10 +57,11 @@ public LinkTokenWithPaymentResource(PlaidClient plaidClient, List plaidP "my client name", this.plaidProducts, this.countryCodes, - "en" - ).withPaymentInitiation(new LinkTokenCreateRequest.PaymentInitiation( - paymentId - )); + "en") + .withRedirectUri(this.redirectUri) + .withPaymentInitiation(new LinkTokenCreateRequest.PaymentInitiation( + paymentId + )); QuickstartApplication.paymentId = paymentId; Response response = this.plaidClient.service().linkTokenCreate(request) .execute(); diff --git a/python/server.py b/python/server.py index a2e688da..be3d88b7 100644 --- a/python/server.py +++ b/python/server.py @@ -29,6 +29,14 @@ # will be able to select institutions from. PLAID_COUNTRY_CODES = os.getenv('PLAID_COUNTRY_CODES', 'US').split(',') + +def empty_to_none(field): + value = os.getenv(field) + if field is None or len(value) == 0: + return None + return field + + # Parameters used for the OAuth redirect Link flow. # # Set PLAID_REDIRECT_URI to 'http://localhost:8000/oauth-response.html' @@ -36,7 +44,7 @@ # that the bank website should redirect to. You will need to configure # this redirect URI for your client ID through the Plaid developer dashboard # at https://dashboard.plaid.com/team/api. -PLAID_REDIRECT_URI = os.getenv('PLAID_REDIRECT_URI') +PLAID_REDIRECT_URI = empty_to_none('PLAID_REDIRECT_URI') client = plaid.Client(client_id=PLAID_CLIENT_ID, secret=PLAID_SECRET, diff --git a/ruby/app.rb b/ruby/app.rb index 4558c1a8..80af779a 100644 --- a/ruby/app.rb +++ b/ruby/app.rb @@ -266,19 +266,30 @@ products: ENV['PLAID_PRODUCTS'].split(','), country_codes: ENV['PLAID_COUNTRY_CODES'].split(','), language: "en", - redirect_uri: ENV['PLAID_REDIRECT_URI'], + redirect_uri: nil_if_empty_envvar('PLAID_REDIRECT_URI'), ) content_type :json { link_token: response.link_token }.to_json rescue Plaid::PlaidAPIError => e error_response = format_error(e) + pretty_print_response(error_response) content_type :json error_response.to_json end end +def nil_if_empty_envvar(field) + val = ENV[field] + puts "val #{val}" + if !val.nil? && val.length > 0 + return val + else + return nil + end +end + # This functionality is only relevant for the UK Payment Initiation product. # Sets the payment token in memory on the server side. We generate a new # payment token so that the developer is not required to supply one. @@ -314,7 +325,7 @@ products: ENV['PLAID_PRODUCTS'].split(','), country_codes: ENV['PLAID_COUNTRY_CODES'].split(','), language: "en", - redirect_uri: ENV['PLAID_REDIRECT_URI'], + redirect_uri: nil_if_empty_envvar('PLAID_REDIRECT_URI'), payment_initiation: { payment_id: payment_id, }, From 8a3ee3f65df396315179b864518afed822217301 Mon Sep 17 00:00:00 2001 From: David Zhang Date: Wed, 22 Jul 2020 15:55:50 -0400 Subject: [PATCH 06/19] fix typo for check --- python/server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/server.py b/python/server.py index be3d88b7..1f5ab914 100644 --- a/python/server.py +++ b/python/server.py @@ -32,7 +32,7 @@ def empty_to_none(field): value = os.getenv(field) - if field is None or len(value) == 0: + if value is None or len(value) == 0: return None return field From f91d1eadaaaddbe3f2ab19b023b2c1d57e080a74 Mon Sep 17 00:00:00 2001 From: Andrew Chen Date: Wed, 22 Jul 2020 16:41:42 -0700 Subject: [PATCH 07/19] update readmes --- README.md | 6 ++++++ go/README.md | 9 ++++++++- java/README.md | 9 ++++++++- node/README.md | 9 ++++++++- python/README.md | 9 ++++++++- ruby/README.md | 9 ++++++++- 6 files changed, 46 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 48911cb3..4caa9c78 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,10 @@ To further adjust the quickstart to your use-case, you can define `PLAID_PRODUCT `PLAID_REDIRECT_URI` in your environment or set the respective `${VARIABLES}` in in the `x-environment` section in [`docker-compose.yml`](/docker-compose.yml) directly. +Note - If you are attempting to test out our OAuth flow, you will need to register your +`PLAID_REDIRECT_URI` in the [Plaid dashboard][dashboard-api-section]. Additionally, if you want to use +the [payment_initiation][payment-initiation] product, you will need to contact sales to get this product enabled. + To see the log output of the quickstart run: `% make QUICKSTART=go logs` (when done, quit using `CTRL-C`). To stop the quickstart use: `% make QUICKSTART=go stop` @@ -29,9 +33,11 @@ Replace `go` in the command examples above with the name of the quickstart you w [quickstart]: https://plaid.com/docs/quickstart [libraries]: https://plaid.com/docs/libraries +[payment-initiation]: https://plaid.com/docs/#payment-initiation [node-example]: /node [ruby-example]: /ruby [python-example]: /python [java-example]: /java [go-example]: /go [docker]: https://www.docker.com +[dashboard-api-section]: https://dashboard.plaid.com/team/api diff --git a/go/README.md b/go/README.md index 49df4ddb..466b97b7 100644 --- a/go/README.md +++ b/go/README.md @@ -39,11 +39,15 @@ which the client can then use to initialize Plaid Link. When the client initializes Plaid Link with the link token, the Plaid Link initialization parameters associated with the Plaid Token will be applied. +Note - If you want to use the [payment_initiation][payment-initiation] product, you +will need to contact sales to get this product enabled. + ## The OAuth redirect flow Some European institutions require an OAuth redirect authentication flow, where the end user is redirected to the bank’s website or mobile app to authenticate. For this flow, you should provide an additional parameter, -`PLAID_REDIRECT_URI`. +`PLAID_REDIRECT_URI`. You will also need to make sure that you register +this `PLAID_REDIRECT_URI` in the [Plaid dashboard][dashboard-api-section]. ``` bash # You will need to configure the PLAID_REDIRECT_URI for @@ -67,3 +71,6 @@ go run server.go # Go to http://localhost:8000 ``` + +[dashboard-api-section]: https://dashboard.plaid.com/team/api +[payment-initiation]: https://plaid.com/docs/#payment-initiation diff --git a/java/README.md b/java/README.md index aaa5938e..ccc2ddb8 100644 --- a/java/README.md +++ b/java/README.md @@ -41,11 +41,15 @@ which the client can then use to initialize Plaid Link. When the client initializes Plaid Link with the link token, the Plaid Link initialization parameters associated with the Plaid Token will be applied. +Note - If you want to use the [payment_initiation][payment-initiation] product, you +will need to contact sales to get this product enabled. + ## The OAuth redirect flow Some European institutions require an OAuth redirect authentication flow, where the end user is redirected to the bank’s website or mobile app to authenticate. For this flow, you should provide an additional parameter, -`PLAID_REDIRECT_URI` +`PLAID_REDIRECT_URI`. You will also need to make sure that you register +this `PLAID_REDIRECT_URI` in the [Plaid dashboard][dashboard-api-section]. ``` bash # You will need to configure the PLAID_REDIRECT_URI for @@ -68,3 +72,6 @@ java -jar target/quickstart-1.0-SNAPSHOT.jar server config.yml # Go to http://localhost:8000 ``` + +[dashboard-api-section]: https://dashboard.plaid.com/team/api +[payment-initiation]: https://plaid.com/docs/#payment-initiation diff --git a/node/README.md b/node/README.md index 53162461..1d43894d 100644 --- a/node/README.md +++ b/node/README.md @@ -40,8 +40,12 @@ which the client can then use to initialize Plaid Link. When the client initializes Plaid Link with the link token, the Plaid Link initialization parameters associated with the Plaid Token will be applied. +Note - If you want to use the [payment_initiation][payment-initiation] product, you +will need to contact sales to get this product enabled. + ## The OAuth redirect flow -Some European institutions require an OAuth redirect authentication flow, where the end user is redirected to the bank’s website or mobile app to authenticate. For this flow, you should provide an additional configuration parameters, `PLAID_REDIRECT_URI`. +Some European institutions require an OAuth redirect authentication flow, where the end user is redirected to the bank’s website or mobile app to authenticate. For this flow, you should provide an additional configuration parameters, `PLAID_REDIRECT_URI`. You will also need to make sure that you register +this `PLAID_REDIRECT_URI` in the [Plaid dashboard][dashboard-api-section]. ``` bash # You will need to configure the PLAID_REDIRECT_URI for @@ -65,3 +69,6 @@ node index.js # Go to http://localhost:8000 ``` + +[dashboard-api-section]: https://dashboard.plaid.com/team/api +[payment-initiation]: https://plaid.com/docs/#payment-initiation diff --git a/python/README.md b/python/README.md index 8a405f0b..928ab810 100644 --- a/python/README.md +++ b/python/README.md @@ -45,11 +45,15 @@ which the client can then use to initialize Plaid Link. When the client initializes Plaid Link with the link token, the Plaid Link initialization parameters associated with the Plaid Token will be applied. +Note - If you want to use the [payment_initiation][payment-initiation] product, you +will need to contact sales to get this product enabled. + ## The OAuth redirect flow Some European institutions require an OAuth redirect authentication flow, where the end user is redirected to the bank’s website or mobile app to authenticate. For this flow, you should provide an additional parameter, -`PLAID_REDIRECT_URI` +`PLAID_REDIRECT_URI`. You will also need to make sure that you register +this `PLAID_REDIRECT_URI` in the [Plaid dashboard][dashboard-api-section]. ``` bash # You will need to configure the PLAID_REDIRECT_URI for @@ -73,3 +77,6 @@ python server.py # Go to http://localhost:8000 ``` + +[dashboard-api-section]: https://dashboard.plaid.com/team/api +[payment-initiation]: https://plaid.com/docs/#payment-initiation diff --git a/ruby/README.md b/ruby/README.md index 2accbdf4..be562f96 100644 --- a/ruby/README.md +++ b/ruby/README.md @@ -40,11 +40,15 @@ which the client can then use to initialize Plaid Link. When the client initializes Plaid Link with the link token, the Plaid Link initialization parameters associated with the Plaid Token will be applied. +Note - If you want to use the [payment_initiation][payment-initiation] product, you +will need to contact sales to get this product enabled. + ## The OAuth redirect flow Some European institutions require an OAuth redirect authentication flow, where the end user is redirected to the bank’s website or mobile app to authenticate. For this flow, you should provide an additional parameter, -`PLAID_REDIRECT_URI` +`PLAID_REDIRECT_URI`. You will also need to make sure that you register +this `PLAID_REDIRECT_URI` in the [Plaid dashboard][dashboard-api-section]. ``` bash # You will need to configure the PLAID_REDIRECT_URI for @@ -67,3 +71,6 @@ PLAID_REDIRECT_URI='http://localhost:8000/oauth-response.html' \ bundle exec ruby app.rb # Go to http://localhost:8000 ``` + +[dashboard-api-section]: https://dashboard.plaid.com/team/api +[payment-initiation]: https://plaid.com/docs/#payment-initiation From b4e3d5f7df83f55666d30dd6196565cfbfd86714 Mon Sep 17 00:00:00 2001 From: Andrew Chen Date: Wed, 22 Jul 2020 18:19:32 -0700 Subject: [PATCH 08/19] Update README.md Co-authored-by: phoenixy1 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4caa9c78..e900439c 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ To further adjust the quickstart to your use-case, you can define `PLAID_PRODUCT `PLAID_REDIRECT_URI` in your environment or set the respective `${VARIABLES}` in in the `x-environment` section in [`docker-compose.yml`](/docker-compose.yml) directly. -Note - If you are attempting to test out our OAuth flow, you will need to register your +Note - If you are attempting to test out the OAuth flow, you will need to register your `PLAID_REDIRECT_URI` in the [Plaid dashboard][dashboard-api-section]. Additionally, if you want to use the [payment_initiation][payment-initiation] product, you will need to contact sales to get this product enabled. From a93ec2c51288cd3d89a3046cb3189807552a3c6f Mon Sep 17 00:00:00 2001 From: Andrew Chen Date: Wed, 22 Jul 2020 18:19:41 -0700 Subject: [PATCH 09/19] Update README.md Co-authored-by: phoenixy1 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e900439c..9b663b80 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ section in [`docker-compose.yml`](/docker-compose.yml) directly. Note - If you are attempting to test out the OAuth flow, you will need to register your `PLAID_REDIRECT_URI` in the [Plaid dashboard][dashboard-api-section]. Additionally, if you want to use -the [payment_initiation][payment-initiation] product, you will need to contact sales to get this product enabled. +the [Payment Initiation][payment-initiation] product, you will need to [contact Sales][contact-sales] to get this product enabled. To see the log output of the quickstart run: `% make QUICKSTART=go logs` (when done, quit using `CTRL-C`). From bb2e84e7cfe10514b4ecd7b84470a911ba8628bf Mon Sep 17 00:00:00 2001 From: Andrew Chen Date: Wed, 22 Jul 2020 18:19:55 -0700 Subject: [PATCH 10/19] Update go/README.md Co-authored-by: phoenixy1 --- go/README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/go/README.md b/go/README.md index 466b97b7..6af40d82 100644 --- a/go/README.md +++ b/go/README.md @@ -39,9 +39,7 @@ which the client can then use to initialize Plaid Link. When the client initializes Plaid Link with the link token, the Plaid Link initialization parameters associated with the Plaid Token will be applied. -Note - If you want to use the [payment_initiation][payment-initiation] product, you -will need to contact sales to get this product enabled. - +Note - If you want to use the [Payment Initiation][payment-initiation] product, you will need to [contact Sales][contact-sales] to get this product enabled. ## The OAuth redirect flow Some European institutions require an OAuth redirect authentication flow, where the end user is redirected to the bank’s website or mobile app to From 667a7e33ca1e3d50e3caba69471533585eebaf40 Mon Sep 17 00:00:00 2001 From: Andrew Chen Date: Wed, 22 Jul 2020 18:20:04 -0700 Subject: [PATCH 11/19] Update node/README.md Co-authored-by: phoenixy1 --- node/README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/node/README.md b/node/README.md index 1d43894d..608edbae 100644 --- a/node/README.md +++ b/node/README.md @@ -39,9 +39,7 @@ which the client can then use to initialize Plaid Link. When the client initializes Plaid Link with the link token, the Plaid Link initialization parameters associated with the Plaid Token will be applied. - -Note - If you want to use the [payment_initiation][payment-initiation] product, you -will need to contact sales to get this product enabled. +Note - If you want to use the [Payment Initiation][payment-initiation] product, you will need to [contact Sales][contact-sales] to get this product enabled. ## The OAuth redirect flow Some European institutions require an OAuth redirect authentication flow, where the end user is redirected to the bank’s website or mobile app to authenticate. For this flow, you should provide an additional configuration parameters, `PLAID_REDIRECT_URI`. You will also need to make sure that you register From c92d1f8e304c7174b1c1a182d3575cd6e68f506d Mon Sep 17 00:00:00 2001 From: Andrew Chen Date: Wed, 22 Jul 2020 18:20:14 -0700 Subject: [PATCH 12/19] Update node/README.md Co-authored-by: phoenixy1 --- node/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/README.md b/node/README.md index 608edbae..4f163401 100644 --- a/node/README.md +++ b/node/README.md @@ -42,7 +42,7 @@ initialization parameters associated with the Plaid Token will be applied. Note - If you want to use the [Payment Initiation][payment-initiation] product, you will need to [contact Sales][contact-sales] to get this product enabled. ## The OAuth redirect flow -Some European institutions require an OAuth redirect authentication flow, where the end user is redirected to the bank’s website or mobile app to authenticate. For this flow, you should provide an additional configuration parameters, `PLAID_REDIRECT_URI`. You will also need to make sure that you register +Some European institutions require an OAuth redirect authentication flow, where the end user is redirected to the bank’s website or mobile app to authenticate. For this flow, you should provide an additional configuration parameter, `PLAID_REDIRECT_URI`. You will also need to make sure that you register this `PLAID_REDIRECT_URI` in the [Plaid dashboard][dashboard-api-section]. ``` bash From 0cc6245a1e59e583f4888e6914d7541d6a8124c2 Mon Sep 17 00:00:00 2001 From: Andrew Chen Date: Wed, 22 Jul 2020 18:20:21 -0700 Subject: [PATCH 13/19] Update ruby/README.md Co-authored-by: phoenixy1 --- ruby/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ruby/README.md b/ruby/README.md index be562f96..32a48bb1 100644 --- a/ruby/README.md +++ b/ruby/README.md @@ -40,8 +40,7 @@ which the client can then use to initialize Plaid Link. When the client initializes Plaid Link with the link token, the Plaid Link initialization parameters associated with the Plaid Token will be applied. -Note - If you want to use the [payment_initiation][payment-initiation] product, you -will need to contact sales to get this product enabled. +Note - If you want to the [Payment Initiation][payment-initiation] product, you will need to [contact Sales][contact-sales] to get this product enabled. ## The OAuth redirect flow Some European institutions require an OAuth redirect authentication flow, From 420f05bc7e61e687e0280911ec136fe697fdcf77 Mon Sep 17 00:00:00 2001 From: Andrew Chen Date: Wed, 22 Jul 2020 18:20:27 -0700 Subject: [PATCH 14/19] Update python/README.md Co-authored-by: phoenixy1 --- python/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/python/README.md b/python/README.md index 928ab810..71ba9dbc 100644 --- a/python/README.md +++ b/python/README.md @@ -45,8 +45,7 @@ which the client can then use to initialize Plaid Link. When the client initializes Plaid Link with the link token, the Plaid Link initialization parameters associated with the Plaid Token will be applied. -Note - If you want to use the [payment_initiation][payment-initiation] product, you -will need to contact sales to get this product enabled. +Note - If you want to use the [Payment Initiation][payment-initiation] product, you will need to [contact Sales][contact-sales] to get this product enabled. ## The OAuth redirect flow Some European institutions require an OAuth redirect authentication flow, From 64f04ecbe18d4370d7363d3dee5629cc3e0f5d24 Mon Sep 17 00:00:00 2001 From: Andrew Chen Date: Wed, 22 Jul 2020 18:20:33 -0700 Subject: [PATCH 15/19] Update README.md Co-authored-by: phoenixy1 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9b663b80..1a2dba8f 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ To stop the quickstart use: `% make QUICKSTART=go stop` Replace `go` in the command examples above with the name of the quickstart you want to start, e.g. `python`. ![Plaid quickstart app](/assets/quickstart-screenshot.png) - +[contact-sales]: https://plaid.com/contact [quickstart]: https://plaid.com/docs/quickstart [libraries]: https://plaid.com/docs/libraries [payment-initiation]: https://plaid.com/docs/#payment-initiation From 729082b091e944fcc1905b57093ab635a99e4cf2 Mon Sep 17 00:00:00 2001 From: Andrew Chen Date: Thu, 23 Jul 2020 14:19:42 -0700 Subject: [PATCH 16/19] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1a2dba8f..97637929 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Here you'll find full example integration apps using our [**client libraries**][ - [Python][python-example] - [Java][java-example] -If [docker][] is available to you, you can quickly spin up an example using: `% make QUICKSTART=go up`. +If [docker][docker] is available to you, you can quickly spin up an example using: `% make QUICKSTART=go up`. Be sure to have `PLAID_CLIENT_ID` and `PLAID_SECRET` defined in your environment or replace the respective `${VARIABLES}` in the `x-environment` section in [`docker-compose.yml`](/docker-compose.yml) directly. @@ -30,7 +30,7 @@ To stop the quickstart use: `% make QUICKSTART=go stop` Replace `go` in the command examples above with the name of the quickstart you want to start, e.g. `python`. ![Plaid quickstart app](/assets/quickstart-screenshot.png) -[contact-sales]: https://plaid.com/contact + [quickstart]: https://plaid.com/docs/quickstart [libraries]: https://plaid.com/docs/libraries [payment-initiation]: https://plaid.com/docs/#payment-initiation From c4c642a59dc221c3937b847e25be8a59a07014c1 Mon Sep 17 00:00:00 2001 From: Andrew Chen Date: Thu, 23 Jul 2020 14:24:06 -0700 Subject: [PATCH 17/19] update the rest of the readmes --- README.md | 1 + go/README.md | 1 + java/README.md | 3 ++- node/README.md | 1 + python/README.md | 1 + ruby/README.md | 1 + 6 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 97637929..fa119d9e 100644 --- a/README.md +++ b/README.md @@ -41,3 +41,4 @@ Replace `go` in the command examples above with the name of the quickstart you w [go-example]: /go [docker]: https://www.docker.com [dashboard-api-section]: https://dashboard.plaid.com/team/api +[contact-sales]: https://plaid.com/contact diff --git a/go/README.md b/go/README.md index 6af40d82..7490ac56 100644 --- a/go/README.md +++ b/go/README.md @@ -72,3 +72,4 @@ go run server.go [dashboard-api-section]: https://dashboard.plaid.com/team/api [payment-initiation]: https://plaid.com/docs/#payment-initiation +[contact-sales]: https://plaid.com/contact diff --git a/java/README.md b/java/README.md index ccc2ddb8..d46f9a7c 100644 --- a/java/README.md +++ b/java/README.md @@ -42,7 +42,7 @@ When the client initializes Plaid Link with the link token, the Plaid Link initialization parameters associated with the Plaid Token will be applied. Note - If you want to use the [payment_initiation][payment-initiation] product, you -will need to contact sales to get this product enabled. +will need to [contact Sales][contact-sales] to get this product enabled. ## The OAuth redirect flow Some European institutions require an OAuth redirect authentication flow, @@ -75,3 +75,4 @@ java -jar target/quickstart-1.0-SNAPSHOT.jar server config.yml [dashboard-api-section]: https://dashboard.plaid.com/team/api [payment-initiation]: https://plaid.com/docs/#payment-initiation +[contact-sales]: https://plaid.com/contact diff --git a/node/README.md b/node/README.md index 4f163401..2f1c9811 100644 --- a/node/README.md +++ b/node/README.md @@ -70,3 +70,4 @@ node index.js [dashboard-api-section]: https://dashboard.plaid.com/team/api [payment-initiation]: https://plaid.com/docs/#payment-initiation +[contact-sales]: https://plaid.com/contact diff --git a/python/README.md b/python/README.md index 71ba9dbc..1bb9b678 100644 --- a/python/README.md +++ b/python/README.md @@ -79,3 +79,4 @@ python server.py [dashboard-api-section]: https://dashboard.plaid.com/team/api [payment-initiation]: https://plaid.com/docs/#payment-initiation +[contact-sales]: https://plaid.com/contact diff --git a/ruby/README.md b/ruby/README.md index 32a48bb1..b1a790c7 100644 --- a/ruby/README.md +++ b/ruby/README.md @@ -73,3 +73,4 @@ bundle exec ruby app.rb [dashboard-api-section]: https://dashboard.plaid.com/team/api [payment-initiation]: https://plaid.com/docs/#payment-initiation +[contact-sales]: https://plaid.com/contact From 8db7b79a20df7ac6298beda5bcd55c7bc6a5e953 Mon Sep 17 00:00:00 2001 From: David Zhang Date: Wed, 29 Jul 2020 09:32:01 -0400 Subject: [PATCH 18/19] format ruby files --- ruby/app.rb | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/ruby/app.rb b/ruby/app.rb index 80af779a..551464a4 100644 --- a/ruby/app.rb +++ b/ruby/app.rb @@ -258,15 +258,15 @@ post '/api/create_link_token' do begin response = client.link_token.create( - user: { - # This should correspond to a unique id for the current user. - client_user_id: "user-id", - }, - client_name: "Plaid Quickstart", - products: ENV['PLAID_PRODUCTS'].split(','), - country_codes: ENV['PLAID_COUNTRY_CODES'].split(','), - language: "en", - redirect_uri: nil_if_empty_envvar('PLAID_REDIRECT_URI'), + user: { + # This should correspond to a unique id for the current user. + client_user_id: "user-id", + }, + client_name: "Plaid Quickstart", + products: ENV['PLAID_PRODUCTS'].split(','), + country_codes: ENV['PLAID_COUNTRY_CODES'].split(','), + language: "en", + redirect_uri: nil_if_empty_envvar('PLAID_REDIRECT_URI'), ) content_type :json @@ -317,18 +317,18 @@ def nil_if_empty_envvar(field) ) payment_id = create_payment_response.payment_id response = client.link_token.create( - user: { - # This should correspond to a unique id for the current user. - client_user_id: "user-id", - }, - client_name: "Plaid Quickstart", - products: ENV['PLAID_PRODUCTS'].split(','), - country_codes: ENV['PLAID_COUNTRY_CODES'].split(','), - language: "en", - redirect_uri: nil_if_empty_envvar('PLAID_REDIRECT_URI'), - payment_initiation: { - payment_id: payment_id, - }, + user: { + # This should correspond to a unique id for the current user. + client_user_id: "user-id", + }, + client_name: "Plaid Quickstart", + products: ENV['PLAID_PRODUCTS'].split(','), + country_codes: ENV['PLAID_COUNTRY_CODES'].split(','), + language: "en", + redirect_uri: nil_if_empty_envvar('PLAID_REDIRECT_URI'), + payment_initiation: { + payment_id: payment_id, + }, ) content_type :json @@ -342,7 +342,8 @@ def nil_if_empty_envvar(field) end def format_error(err) - { error: { + { + error: { error_code: err.error_code, error_message: err.error_message, error_type: err.error_type From bcc63508b1fefd0f5fa6852553ddffa8125c0db7 Mon Sep 17 00:00:00 2001 From: David Zhang Date: Thu, 6 Aug 2020 11:12:47 -0400 Subject: [PATCH 19/19] update java quickstart for 7.0.1 --- java/pom.xml | 2 +- .../resources/LinkTokenWithPaymentResource.java | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/java/pom.xml b/java/pom.xml index 7d8b5ce7..7e584d48 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -54,7 +54,7 @@ com.plaid plaid-java - 6.0.1 + 7.0.1 javax.xml.bind diff --git a/java/src/main/java/com/plaid/quickstart/resources/LinkTokenWithPaymentResource.java b/java/src/main/java/com/plaid/quickstart/resources/LinkTokenWithPaymentResource.java index 3df483e2..b8df7ebe 100644 --- a/java/src/main/java/com/plaid/quickstart/resources/LinkTokenWithPaymentResource.java +++ b/java/src/main/java/com/plaid/quickstart/resources/LinkTokenWithPaymentResource.java @@ -36,14 +36,12 @@ public LinkTokenWithPaymentResource(PlaidClient plaidClient, List plaidP } @POST public LinkTokenResource.LinkToken getLinkToken() throws IOException { + RecipientCreateRequest recipientRequest = new RecipientCreateRequest( + "Harry Potter") + .withIban("GB33BUKB20201555555555") + .withAddress(new Address(Arrays.asList("4 Privet Drive"), "Little Whinging", "11111", "GB")); Response recipientResponse = - this.plaidClient.service().recipientCreate(new RecipientCreateRequest( - "Harry Potter", - "GB33BUKB20201555555555", - new Address(Arrays.asList("4 Privet Drive"), - "Little Whinging", - "11111", - "GB"))).execute(); + this.plaidClient.service().recipientCreate(recipientRequest).execute(); Response paymentCreateResponse = this.plaidClient.service().paymentCreate(new PaymentCreateRequest(