Skip to content

Commit

Permalink
Merge pull request #503 from plaid/phoenixy1-clib-updates
Browse files Browse the repository at this point in the history
update to latest version of client libraries; make ruby execution script use `bundle exec`
  • Loading branch information
phoenixy1 authored Nov 16, 2024
2 parents 9cafb63 + 531f6b7 commit 9ffc26b
Show file tree
Hide file tree
Showing 15 changed files with 37 additions and 41 deletions.
2 changes: 1 addition & 1 deletion go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.22
require (
github.com/gin-gonic/gin v1.10.0
github.com/joho/godotenv v1.5.1
github.com/plaid/plaid-go/v27 v27.0.0
github.com/plaid/plaid-go/v31 v31.0.0
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
github.com/plaid/plaid-go/v27 v27.0.0 h1:Qw08VLcwkndcPSD8abJv/piFM7hePLip30eGBFCx8pY=
github.com/plaid/plaid-go/v27 v27.0.0/go.mod h1:pKlJaLQRFMPPoB041jyAsSeo+uofQ85eazJSToXPpHE=
github.com/plaid/plaid-go/v31 v31.0.0 h1:1ffWhY+AZ8dUN0RiJYLXQKNl1hzfTW/NPYRcGMmXLLM=
github.com/plaid/plaid-go/v31 v31.0.0/go.mod h1:12wSDVT0IqD47PN8nOGP8RMBRmsoXEkLD9MX0pZfEQw=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
Expand Down
23 changes: 14 additions & 9 deletions go/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

"github.com/gin-gonic/gin"
"github.com/joho/godotenv"
plaid "github.com/plaid/plaid-go/v27/plaid"
plaid "github.com/plaid/plaid-go/v31/plaid"
)

var (
Expand Down Expand Up @@ -812,7 +812,8 @@ func getCraBaseReportHandler(c *gin.Context) {
return
}

pdfRequest := plaid.NewCraCheckReportPDFGetRequest(userToken)
pdfRequest := plaid.NewCraCheckReportPDFGetRequest()
pdfRequest.SetUserToken(userToken)
pdfResponse, _, err := client.PlaidApi.CraCheckReportPdfGet(ctx).CraCheckReportPDFGetRequest(*pdfRequest).Execute()
if err != nil {
renderError(c, err)
Expand All @@ -837,8 +838,9 @@ func getCraBaseReportHandler(c *gin.Context) {

func getCraBaseReportWithRetries(ctx context.Context, userToken string) (*plaid.CraCheckReportBaseReportGetResponse, error) {
return pollWithRetries(func() (*plaid.CraCheckReportBaseReportGetResponse, error) {
request := plaid.CraCheckReportBaseReportGetRequest{UserToken: userToken}
response, _, err := client.PlaidApi.CraCheckReportBaseReportGet(ctx).CraCheckReportBaseReportGetRequest(request).Execute()
request := plaid.NewCraCheckReportBaseReportGetRequest()
request.SetUserToken(userToken)
response, _, err := client.PlaidApi.CraCheckReportBaseReportGet(ctx).CraCheckReportBaseReportGetRequest(*request).Execute()
return &response, err
}, 1000, 20)
}
Expand All @@ -854,7 +856,8 @@ func getCraIncomeInsightsHandler(c *gin.Context) {
return
}

pdfRequest := plaid.NewCraCheckReportPDFGetRequest(userToken)
pdfRequest := plaid.NewCraCheckReportPDFGetRequest()
pdfRequest.SetUserToken(userToken)
pdfRequest.SetAddOns([]plaid.CraPDFAddOns{plaid.CRAPDFADDONS_CRA_INCOME_INSIGHTS})
pdfResponse, _, err := client.PlaidApi.CraCheckReportPdfGet(ctx).CraCheckReportPDFGetRequest(*pdfRequest).Execute()
if err != nil {
Expand All @@ -880,8 +883,9 @@ func getCraIncomeInsightsHandler(c *gin.Context) {

func getCraIncomeInsightsWithRetries(ctx context.Context, userToken string) (*plaid.CraCheckReportIncomeInsightsGetResponse, error) {
return pollWithRetries(func() (*plaid.CraCheckReportIncomeInsightsGetResponse, error) {
request := plaid.CraCheckReportIncomeInsightsGetRequest{UserToken: userToken}
response, _, err := client.PlaidApi.CraCheckReportIncomeInsightsGet(ctx).CraCheckReportIncomeInsightsGetRequest(request).Execute()
request := plaid.NewCraCheckReportIncomeInsightsGetRequest()
request.SetUserToken(userToken)
response, _, err := client.PlaidApi.CraCheckReportIncomeInsightsGet(ctx).CraCheckReportIncomeInsightsGetRequest(*request).Execute()
return &response, err
}, 1000, 20)
}
Expand All @@ -903,8 +907,9 @@ func getCraPartnerInsightsHandler(c *gin.Context) {

func getCraPartnerInsightsWithRetries(ctx context.Context, userToken string) (*plaid.CraCheckReportPartnerInsightsGetResponse, error) {
return pollWithRetries(func() (*plaid.CraCheckReportPartnerInsightsGetResponse, error) {
request := plaid.CraCheckReportPartnerInsightsGetRequest{UserToken: userToken}
response, _, err := client.PlaidApi.CraCheckReportPartnerInsightsGet(ctx).CraCheckReportPartnerInsightsGetRequest(request).Execute()
request := plaid.NewCraCheckReportPartnerInsightsGetRequest()
request.SetUserToken(userToken)
response, _, err := client.PlaidApi.CraCheckReportPartnerInsightsGet(ctx).CraCheckReportPartnerInsightsGetRequest(*request).Execute()
return &response, err
}, 1000, 20)
}
Expand Down
2 changes: 1 addition & 1 deletion java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<dependency>
<groupId>com.plaid</groupId>
<artifactId>plaid-java</artifactId>
<version>25.0.0</version>
<version>29.0.0</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import com.plaid.client.model.InstitutionsGetByIdRequest;
import com.plaid.client.model.InstitutionsGetByIdResponse;
import com.plaid.client.model.Institution;
import com.plaid.client.model.Item;
import com.plaid.client.model.ItemWithConsentFields;
import com.plaid.quickstart.QuickstartApplication;

import javax.ws.rs.GET;
Expand Down Expand Up @@ -55,12 +55,12 @@ public ItemResponse getItem() throws IOException {

public static class ItemResponse {
@JsonProperty
public Item item;
public ItemWithConsentFields item;

@JsonProperty
public Institution institution;

public ItemResponse(Item item, Institution institution) {
public ItemResponse(ItemWithConsentFields item, Institution institution) {
this.item = item;
this.institution = institution;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.plaid.client.model.ConsumerReportPermissiblePurpose;
import com.plaid.client.model.CountryCode;
import com.plaid.client.model.CraCheckReportProduct;
import com.plaid.client.model.LinkTokenCreateRequest;
import com.plaid.client.model.LinkTokenCreateRequestCraOptions;
import com.plaid.client.model.LinkTokenCreateRequestStatements;
Expand Down Expand Up @@ -86,8 +85,7 @@ public LinkToken(String linkToken) {
request.setStatements(statementsConfig);
}

List<CraCheckReportProduct> craCheckReportProducts = Arrays.asList(CraCheckReportProduct.values());
if (craCheckReportProducts.stream().map(CraCheckReportProduct::toString).anyMatch(plaidProducts::contains)) {
if (plaidProducts.stream().anyMatch(product -> product.startsWith("cra_"))) {
request.userToken(QuickstartApplication.userToken);
request.consumerReportPermissiblePurpose(ConsumerReportPermissiblePurpose.ACCOUNT_REVIEW_CREDIT);
LinkTokenCreateRequestCraOptions options = new LinkTokenCreateRequestCraOptions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.plaid.client.model.AddressData;
import com.plaid.client.model.ConsumerReportUserIdentity;
import com.plaid.client.model.CraCheckReportProduct;
import com.plaid.client.model.UserCreateRequest;
import com.plaid.client.model.UserCreateResponse;
import com.plaid.client.request.PlaidApi;
Expand Down Expand Up @@ -38,8 +37,7 @@ public UserCreateResponse createUserToken() throws IOException {
// Typically, this will be a user ID number from your application.
.clientUserId("user_" + UUID.randomUUID());

List<CraCheckReportProduct> craCheckReportProducts = Arrays.asList(CraCheckReportProduct.values());
if (craCheckReportProducts.stream().map(CraCheckReportProduct::toString).anyMatch(plaidProducts::contains)) {
if (plaidProducts.stream().anyMatch(product -> product.startsWith("cra_"))) {
AddressData addressData = new AddressData()
.city("New York")
.region("NY")
Expand Down
6 changes: 2 additions & 4 deletions node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ app.post('/api/create_link_token', function (request, response, next) {
configs.statements = statementConfig;
}

const craEnumValues = Object.values(CraCheckReportProduct);
if (PLAID_PRODUCTS.some(product => craEnumValues.includes(product))) {
if (PLAID_PRODUCTS.some(product => product.startsWith("cra_"))) {
configs.user_token = USER_TOKEN;
configs.cra_options = {
days_requested: 60
Expand All @@ -150,8 +149,7 @@ app.post('/api/create_user_token', function (request, response, next) {
client_user_id: 'user_' + uuidv4()
}

const craEnumValues = Object.values(CraCheckReportProduct);
if (PLAID_PRODUCTS.some(product => craEnumValues.includes(product))) {
if (PLAID_PRODUCTS.some(product => product.startsWith("cra_"))) {
request.consumer_report_user_identity = {
first_name: 'Harry',
last_name: 'Potter',
Expand Down
9 changes: 4 additions & 5 deletions node/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"express": "4.16.x",
"moment": "2.22.x",
"nodemon": "^2.0.20",
"plaid": "^26.0.0",
"plaid": "^30.0.0",
"uuid": "^9.0.0"
}
}
2 changes: 1 addition & 1 deletion python/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Flask==3.0.0
plaid_python==24.0.0
plaid_python==28.0.0
python-dotenv==0.15.0
itsdangerous==2.1.2
werkzeug==3.0.1
2 changes: 1 addition & 1 deletion ruby/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ gem 'http'

gem "dotenv", "~> 2.7"

gem "plaid", "= 30.0.0"
gem "plaid", "= 34.0.0"

gem "webrick"
4 changes: 2 additions & 2 deletions ruby/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ GEM
ruby2_keywords (~> 0.0.1)
net-http (0.4.1)
uri
plaid (30.0.0)
plaid (34.0.0)
faraday (>= 1.0.1, < 3.0)
faraday-multipart (>= 1.0.1, < 2.0)
public_suffix (5.0.1)
Expand All @@ -61,7 +61,7 @@ PLATFORMS
DEPENDENCIES
dotenv (~> 2.7)
http
plaid (= 30.0.0)
plaid (= 34.0.0)
sinatra
webrick

Expand Down
6 changes: 2 additions & 4 deletions ruby/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,7 @@
)
link_token_create_request.statements=statements
end
cra_enum_values = Plaid::CraCheckReportProduct.constants.map { |c| Plaid::CraCheckReportProduct.const_get(c) }
if products.any? { |product| cra_enum_values.include?(product) }
if products.any? { |product| product.start_with?("cra_") }
link_token_create_request.cra_options = Plaid::LinkTokenCreateRequestCraOptions.new(
days_requested: 60
)
Expand Down Expand Up @@ -521,8 +520,7 @@
client_user_id: 'user_' + SecureRandom.uuid
}

cra_enum_values = Plaid::CraCheckReportProduct.constants.map { |c| Plaid::CraCheckReportProduct.const_get(c) }
if products.any? { |product| cra_enum_values.include?(product) }
if products.any? { |product| product.start_with?("cra_") }
request_data[:consumer_report_user_identity] = {
first_name: 'Harry',
last_name: 'Potter',
Expand Down
2 changes: 1 addition & 1 deletion ruby/start.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

ruby app.rb
bundle exec ruby app.rb

0 comments on commit 9ffc26b

Please sign in to comment.