Skip to content
This repository has been archived by the owner on Jul 7, 2021. It is now read-only.

Commit

Permalink
Integrate eo iwfy (#332)
Browse files Browse the repository at this point in the history
integrate EO static analyzer iwillfailyou
  • Loading branch information
ccostin93 committed Aug 9, 2020
1 parent 467ae47 commit 0c6e3b3
Show file tree
Hide file tree
Showing 92 changed files with 434 additions and 304 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ addons:
organization: proshin-roman-github
install: true
script:
- mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar
- mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package iwillfailyou:iwillfailyou sonar:sonar
after_success:
- mvn coveralls:report
- bash <(curl -s https://codecov.io/bash)
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ The project is following the next principles (it is a subset of [those ones](htt
- No instanceof, type casting or reflection
- No implementation inheritance

All badges are through [iwillfailyou](https://iwillfailyou.com/)

![nullfree status](https://iwillfailyou.com/nullfree/proshin-roman/finapi-java-client)
![staticfree status](https://iwillfailyou.com/staticfree/proshin-roman/finapi-java-client)
![allfinal status](https://iwillfailyou.com/allfinal/proshin-roman/finapi-java-client)
![allpublic status](https://iwillfailyou.com/allpublic/proshin-roman/finapi-java-client)

## How to use

Just add the following lines into your `pom.xml`
Expand Down
33 changes: 32 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
<dependency>
<groupId>org.cactoos</groupId>
<artifactId>cactoos</artifactId>
<version>0.44</version>
<version>0.46</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
Expand Down Expand Up @@ -265,6 +265,37 @@
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>

<plugin>
<groupId>com.iwillfailyou</groupId>
<artifactId>iwillfailyou-maven-plugin</artifactId>
<version>0.2.0</version>

<!-- then configure it, if you need: -->
<configuration>
<offline>false</offline><!-- default false -->
<nullfree>
<disabled>false</disabled><!-- default false -->
<threshold>0</threshold><!-- default 0 -->
<skipComparisons>true</skipComparisons><!-- default false -->
</nullfree>
<staticfree>
<disabled>false</disabled><!-- default false -->
<threshold>0</threshold><!-- default 0 -->
</staticfree>
<allfinal>
<disabled>false</disabled><!-- default false -->
<threshold>0</threshold><!-- default 0 -->
<skipInterfaceMethodParams>true</skipInterfaceMethodParams><!-- default true -->
<skipLambdaParams>true</skipLambdaParams><!-- default false -->
<skipCatchParams>false</skipCatchParams><!-- default false -->
</allfinal>
<allpublic>
<disabled>false</disabled><!-- default false -->
<threshold>0</threshold><!-- default 0 -->
</allpublic>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.proshin.finapi.primitives.IterableJsonArray;
import org.proshin.finapi.primitives.optional.OptionalOffsetDateTimeOf;

public class FpAccountInterface implements AccountInterface {
public final class FpAccountInterface implements AccountInterface {

private final JSONObject origin;

Expand Down
21 changes: 0 additions & 21 deletions src/main/java/org/proshin/finapi/account/Type.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,25 +53,4 @@ public enum Type {
public int asCode() {
return this.code;
}

/**
* @deprecated since v0.1.92 due to PSD2-related changes
*/
@Deprecated
public static class TypeOf {
private final int code;

public TypeOf(final int code) {
this.code = code;
}

public Type get() {
for (final Type type : values()) {
if (type.asCode() == this.code) {
return type;
}
}
throw new IllegalArgumentException(String.format("Unknown type %d", this.code));
}
}
}
37 changes: 37 additions & 0 deletions src/main/java/org/proshin/finapi/account/TypeOf.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright 2020 Roman Proshin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.proshin.finapi.account;

/**
* @deprecated since v0.1.92 due to PSD2-related changes
*/
@Deprecated
public final class TypeOf {
private final int code;

public TypeOf(final int code) {
this.code = code;
}

public Type get() {
for (final Type type : Type.values()) {
if (type.asCode() == this.code) {
return type;
}
}
throw new IllegalArgumentException(String.format("Unknown type %d", this.code));
}
}
89 changes: 89 additions & 0 deletions src/main/java/org/proshin/finapi/account/in/Debtor.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/*
* Copyright 2020 Roman Proshin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.proshin.finapi.account.in;

import java.math.BigDecimal;
import java.time.LocalDate;
import org.json.JSONObject;
import org.proshin.finapi.Jsonable;
import org.proshin.finapi.primitives.StringOf;

public final class Debtor implements Jsonable {
private final JSONObject origin;

public Debtor() {
this(new JSONObject());
}

public Debtor(final JSONObject origin) {
this.origin = origin;
}

public Debtor withName(final String name) {
this.origin.put("debitorName", name);
return this;
}

public Debtor withIban(final String iban) {
this.origin.put("debitorIban", iban);
return this;
}

public Debtor withBic(final String bic) {
this.origin.put("debitorBic", bic);
return this;
}

public Debtor withAmount(final BigDecimal amount) {
this.origin.put("amount", amount);
return this;
}

public Debtor withPurpose(final String purpose) {
this.origin.put("purpose", purpose);
return this;
}

public Debtor withSepaPurposeCode(final String sepaPurposeCode) {
this.origin.put("sepaPurposeCode", sepaPurposeCode);
return this;
}

public Debtor withMandateId(final String mandateId) {
this.origin.put("mandateId", mandateId);
return this;
}

public Debtor withMandateDate(final LocalDate mandateDate) {
this.origin.put("mandateDate", new StringOf(mandateDate));
return this;
}

public Debtor withCreditorId(final String creditorId) {
this.origin.put("creditorId", creditorId);
return this;
}

public Debtor withEndToEndId(final String endToEndId) {
this.origin.put("endToEndId", endToEndId);
return this;
}

@Override
public JSONObject asJson() {
return this.origin;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package org.proshin.finapi.account.in;

import java.math.BigDecimal;
import java.time.LocalDate;
import org.json.JSONObject;
import org.proshin.finapi.Jsonable;
Expand Down Expand Up @@ -112,71 +111,4 @@ public enum DirectDebitType {
public enum SequenceType {
OOFF, FRST, RCUR, FNAL
}

public static final class Debtor implements Jsonable {
private final JSONObject origin;

public Debtor() {
this(new JSONObject());
}

public Debtor(final JSONObject origin) {
this.origin = origin;
}

public Debtor withName(final String name) {
this.origin.put("debitorName", name);
return this;
}

public Debtor withIban(final String iban) {
this.origin.put("debitorIban", iban);
return this;
}

public Debtor withBic(final String bic) {
this.origin.put("debitorBic", bic);
return this;
}

public Debtor withAmount(final BigDecimal amount) {
this.origin.put("amount", amount);
return this;
}

public Debtor withPurpose(final String purpose) {
this.origin.put("purpose", purpose);
return this;
}

public Debtor withSepaPurposeCode(final String sepaPurposeCode) {
this.origin.put("sepaPurposeCode", sepaPurposeCode);
return this;
}

public Debtor withMandateId(final String mandateId) {
this.origin.put("mandateId", mandateId);
return this;
}

public Debtor withMandateDate(final LocalDate mandateDate) {
this.origin.put("mandateDate", new StringOf(mandateDate));
return this;
}

public Debtor withCreditorId(final String creditorId) {
this.origin.put("creditorId", creditorId);
return this;
}

public Debtor withEndToEndId(final String endToEndId) {
this.origin.put("endToEndId", endToEndId);
return this;
}

@Override
public JSONObject asJson() {
return this.origin;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package org.proshin.finapi.account.in;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Iterator;
import org.cactoos.iterator.IteratorOf;
Expand Down Expand Up @@ -112,62 +111,4 @@ public MoneyTransferParameters withMultiStepAuthentication(final MultiStepAuthen
public JSONObject asJson() {
return this.origin;
}

public static final class Recipient implements Jsonable {

private final JSONObject origin;

public Recipient() {
this(new JSONObject());
}

public Recipient(final JSONObject origin) {
this.origin = origin;
}

public Recipient withName(final String name) {
this.origin.put("recipientName", name);
return this;
}

public Recipient withIban(final String iban) {
this.origin.put("recipientIban", iban);
return this;
}

public Recipient withBic(final String bic) {
this.origin.put("recipientBic", bic);
return this;
}

public Recipient withClearingAccount(final String id) {
this.origin.put("clearingAccountId", id);
return this;
}

public Recipient withEndToEndId(final String endToEndId) {
this.origin.put("endToEndId", endToEndId);
return this;
}

public Recipient withAmount(final BigDecimal amount) {
this.origin.put("amount", amount);
return this;
}

public Recipient withPurpose(final String purpose) {
this.origin.put("purpose", purpose);
return this;
}

public Recipient withSepaPurposeCode(final String sepaPurposeCode) {
this.origin.put("sepaPurposeCode", sepaPurposeCode);
return this;
}

@Override
public JSONObject asJson() {
return this.origin;
}
}
}
Loading

0 comments on commit 0c6e3b3

Please sign in to comment.