-
Notifications
You must be signed in to change notification settings - Fork 16
DEV-131471 SDKs - add plaid data points #211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
bernardodemelo
wants to merge
4
commits into
master
Choose a base branch
from
DEV-131471-jdk
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,3 +14,4 @@ lib/* | |
| */target/ | ||
| /target/ | ||
| /.metadata/ | ||
| .metals/* | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
riskified-sdk/src/main/java/com/riskified/models/InitiatedReturnRisk.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| package com.riskified.models; | ||
|
|
||
| public class InitiatedReturnRisk { | ||
| private int score; | ||
| private int riskTier; | ||
|
|
||
| public int getScore() { | ||
| return score; | ||
| } | ||
| public void setScore(int score) { | ||
| this.score = score; | ||
| } | ||
| public int getRiskTier() { | ||
| return riskTier; | ||
| } | ||
|
|
||
| public void setRiskTier(int riskTier) { | ||
| this.riskTier = riskTier; | ||
| } | ||
| } |
22 changes: 22 additions & 0 deletions
22
riskified-sdk/src/main/java/com/riskified/models/PlaidScores.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| package com.riskified.models; | ||
|
|
||
| public class PlaidScores { | ||
| private InitiatedReturnRisk customerInitiatedReturnRisk; | ||
| private InitiatedReturnRisk bankInitiatedReturnRisk; | ||
|
|
||
| public InitiatedReturnRisk getCustomerInitiatedReturnRisk() { | ||
| return customerInitiatedReturnRisk; | ||
| } | ||
|
|
||
| public void setCustomerInitiatedReturnRisk(InitiatedReturnRisk customerInitiatedReturnRisk) { | ||
| this.customerInitiatedReturnRisk = customerInitiatedReturnRisk; | ||
| } | ||
|
|
||
| public InitiatedReturnRisk getBankInitiatedReturnRisk() { | ||
| return bankInitiatedReturnRisk; | ||
| } | ||
|
|
||
| public void setBankInitiatedReturnRisk(InitiatedReturnRisk bankInitiatedReturnRisk) { | ||
| this.bankInitiatedReturnRisk = bankInitiatedReturnRisk; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,4 +57,81 @@ public void testBankWirePaymentTypeSerializesToBankTransfer() { | |
| String json = gson.toJson(bankWire); | ||
| assertTrue(json.contains("\"payment_type\":\"bank_transfer\"")); | ||
| } | ||
|
|
||
| @Test | ||
| public void testBankWirePlaidScalarFieldsSerializeWithCorrectKeys() { | ||
| BankWirePaymentDetails bankWire = new BankWirePaymentDetails("123456789", "021000021"); | ||
| bankWire.setDaysSinceAccountOpening(90); | ||
| bankWire.setDaysWithNegativeBalanceCount(4); | ||
| bankWire.setIsSavingsOrMoneyMarketAccount(true); | ||
| bankWire.setNsfOverdraftTransactionsCount(31); | ||
| bankWire.setUnauthorizedTransactionsCount(2); | ||
|
|
||
| String json = gson.toJson(bankWire); | ||
|
|
||
| assertTrue(json.contains("\"days_since_account_opening\":90")); | ||
| assertTrue(json.contains("\"days_with_negative_balance_count\":4")); | ||
| assertTrue(json.contains("\"is_savings_or_money_market_account\":true")); | ||
| assertTrue(json.contains("\"nsf_overdraft_transactions_count\":31")); | ||
| assertTrue(json.contains("\"unauthorized_transactions_count\":2")); | ||
| } | ||
|
|
||
| @Test | ||
| public void testBankWirePlaidScoresGetterAndSetter() { | ||
| BankWirePaymentDetails bankWire = new BankWirePaymentDetails("123456789", "021000021"); | ||
|
|
||
| InitiatedReturnRisk customerRisk = new InitiatedReturnRisk(); | ||
| customerRisk.setScore(9); | ||
| customerRisk.setRiskTier(1); | ||
|
|
||
| InitiatedReturnRisk bankRisk = new InitiatedReturnRisk(); | ||
| bankRisk.setScore(82); | ||
| bankRisk.setRiskTier(7); | ||
|
|
||
| PlaidScores plaidScores = new PlaidScores(); | ||
| plaidScores.setCustomerInitiatedReturnRisk(customerRisk); | ||
| plaidScores.setBankInitiatedReturnRisk(bankRisk); | ||
|
|
||
| bankWire.setPlaidScores(plaidScores); | ||
|
|
||
| assertEquals(9, bankWire.getPlaidScores().getCustomerInitiatedReturnRisk().getScore()); | ||
| assertEquals(1, bankWire.getPlaidScores().getCustomerInitiatedReturnRisk().getRiskTier()); | ||
| assertEquals(82, bankWire.getPlaidScores().getBankInitiatedReturnRisk().getScore()); | ||
| assertEquals(7, bankWire.getPlaidScores().getBankInitiatedReturnRisk().getRiskTier()); | ||
| } | ||
|
|
||
| @Test | ||
| public void testBankWirePlaidScoresSerializeWithCorrectStructure() { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can merge this with |
||
| BankWirePaymentDetails bankWire = new BankWirePaymentDetails("123456789", "021000021"); | ||
|
|
||
| InitiatedReturnRisk customerRisk = new InitiatedReturnRisk(); | ||
| customerRisk.setScore(9); | ||
| customerRisk.setRiskTier(1); | ||
|
|
||
| InitiatedReturnRisk bankRisk = new InitiatedReturnRisk(); | ||
| bankRisk.setScore(82); | ||
| bankRisk.setRiskTier(7); | ||
|
|
||
| PlaidScores plaidScores = new PlaidScores(); | ||
| plaidScores.setCustomerInitiatedReturnRisk(customerRisk); | ||
| plaidScores.setBankInitiatedReturnRisk(bankRisk); | ||
|
|
||
| bankWire.setPlaidScores(plaidScores); | ||
|
|
||
| String json = gson.toJson(bankWire); | ||
|
|
||
| assertTrue(json.contains("\"plaid_scores\"")); | ||
| assertTrue(json.contains("\"customer_initiated_return_risk\"")); | ||
| assertTrue(json.contains("\"bank_initiated_return_risk\"")); | ||
| assertTrue(json.contains("\"score\":9")); | ||
| assertTrue(json.contains("\"risk_tier\":1")); | ||
| assertTrue(json.contains("\"score\":82")); | ||
| assertTrue(json.contains("\"risk_tier\":7")); | ||
| } | ||
|
|
||
| @Test | ||
| public void testBankWirePlaidScoresNullByDefault() { | ||
| BankWirePaymentDetails bankWire = new BankWirePaymentDetails("123456789", "021000021"); | ||
| assertNull(bankWire.getPlaidScores()); | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think we need this test