file_name
stringlengths 6
86
| file_path
stringlengths 45
249
| content
stringlengths 47
6.26M
| file_size
int64 47
6.26M
| language
stringclasses 1
value | extension
stringclasses 1
value | repo_name
stringclasses 767
values | repo_stars
int64 8
14.4k
| repo_forks
int64 0
1.17k
| repo_open_issues
int64 0
788
| repo_created_at
stringclasses 767
values | repo_pushed_at
stringclasses 767
values |
---|---|---|---|---|---|---|---|---|---|---|---|
StartScaprocessResponse.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/StartScaprocessResponse.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import javax.annotation.Generated;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class StartScaprocessResponse {
private ScaStatus scaStatus;
private String authorisationId;
private List<AuthenticationObject> scaMethods;
private Object chosenScaMethod;
private ChallengeData challengeData;
@JsonProperty("_links")
private Map<String, HrefType> links;
private String psuMessage;
private List<TppMessageGeneric> tppMessage;
public ScaStatus getScaStatus() {
return scaStatus;
}
public void setScaStatus(ScaStatus scaStatus) {
this.scaStatus = scaStatus;
}
public String getAuthorisationId() {
return authorisationId;
}
public void setAuthorisationId(String authorisationId) {
this.authorisationId = authorisationId;
}
public List<AuthenticationObject> getScaMethods() {
return scaMethods;
}
public void setScaMethods(List<AuthenticationObject> scaMethods) {
this.scaMethods = scaMethods;
}
public Object getChosenScaMethod() {
return chosenScaMethod;
}
public void setChosenScaMethod(Object chosenScaMethod) {
this.chosenScaMethod = chosenScaMethod;
}
public ChallengeData getChallengeData() {
return challengeData;
}
public void setChallengeData(ChallengeData challengeData) {
this.challengeData = challengeData;
}
public Map<String, HrefType> getLinks() {
return links;
}
public void setLinks(Map<String, HrefType> links) {
this.links = links;
}
public String getPsuMessage() {
return psuMessage;
}
public void setPsuMessage(String psuMessage) {
this.psuMessage = psuMessage;
}
public List<TppMessageGeneric> getTppMessage() {
return tppMessage;
}
public void setTppMessage(List<TppMessageGeneric> tppMessage) {
this.tppMessage = tppMessage;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
StartScaprocessResponse that = (StartScaprocessResponse) o;
return Objects.equals(scaStatus, that.scaStatus) &&
Objects.equals(authorisationId, that.authorisationId) &&
Objects.equals(scaMethods, that.scaMethods) &&
Objects.equals(chosenScaMethod, that.chosenScaMethod) &&
Objects.equals(challengeData, that.challengeData) &&
Objects.equals(links, that.links) &&
Objects.equals(psuMessage, that.psuMessage) &&
Objects.equals(tppMessage, that.tppMessage);
}
@Override
public int hashCode() {
return Objects.hash(scaStatus,
authorisationId,
scaMethods,
chosenScaMethod,
challengeData,
links,
psuMessage,
tppMessage);
}
}
| 3,940 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
ScaStatusResponse.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/ScaStatusResponse.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import javax.annotation.Generated;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class ScaStatusResponse {
private ScaStatus scaStatus;
private String psuMessage;
private Boolean trustedBeneficiaryFlag;
@JsonProperty("_links")
private Map<String, HrefType> links;
private List<TppMessageGeneric> tppMessage;
public ScaStatus getScaStatus() {
return scaStatus;
}
public void setScaStatus(ScaStatus scaStatus) {
this.scaStatus = scaStatus;
}
public String getPsuMessage() {
return psuMessage;
}
public void setPsuMessage(String psuMessage) {
this.psuMessage = psuMessage;
}
public Boolean getTrustedBeneficiaryFlag() {
return trustedBeneficiaryFlag;
}
public void setTrustedBeneficiaryFlag(Boolean trustedBeneficiaryFlag) {
this.trustedBeneficiaryFlag = trustedBeneficiaryFlag;
}
public Map<String, HrefType> getLinks() {
return links;
}
public void setLinks(Map<String, HrefType> links) {
this.links = links;
}
public List<TppMessageGeneric> getTppMessage() {
return tppMessage;
}
public void setTppMessage(List<TppMessageGeneric> tppMessage) {
this.tppMessage = tppMessage;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ScaStatusResponse that = (ScaStatusResponse) o;
return Objects.equals(scaStatus, that.scaStatus) &&
Objects.equals(psuMessage, that.psuMessage) &&
Objects.equals(trustedBeneficiaryFlag, that.trustedBeneficiaryFlag) &&
Objects.equals(links, that.links) &&
Objects.equals(tppMessage, that.tppMessage);
}
@Override
public int hashCode() {
return Objects.hash(scaStatus,
psuMessage,
trustedBeneficiaryFlag,
links,
tppMessage);
}
}
| 2,991 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
TppMessageGeneric.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/TppMessageGeneric.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import javax.annotation.Generated;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class TppMessageGeneric {
private TppMessageCategory category;
private TppMessageCategory code;
private String path;
private String text;
public TppMessageCategory getCategory() {
return category;
}
public void setCategory(TppMessageCategory category) {
this.category = category;
}
public TppMessageCategory getCode() {
return code;
}
public void setCode(TppMessageCategory code) {
this.code = code;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TppMessageGeneric that = (TppMessageGeneric) o;
return Objects.equals(category, that.category) &&
Objects.equals(code, that.code) &&
Objects.equals(path, that.path) &&
Objects.equals(text, that.text);
}
@Override
public int hashCode() {
return Objects.hash(category,
code,
path,
text);
}
}
| 2,286 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
ReadAccountBalanceResponse200.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/ReadAccountBalanceResponse200.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import javax.annotation.Generated;
import java.util.List;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class ReadAccountBalanceResponse200 {
private AccountReference account;
private List<Balance> balances;
public AccountReference getAccount() {
return account;
}
public void setAccount(AccountReference account) {
this.account = account;
}
public List<Balance> getBalances() {
return balances;
}
public void setBalances(List<Balance> balances) {
this.balances = balances;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ReadAccountBalanceResponse200 that = (ReadAccountBalanceResponse200) o;
return Objects.equals(account, that.account) &&
Objects.equals(balances, that.balances);
}
@Override
public int hashCode() {
return Objects.hash(account,
balances);
}
}
| 1,912 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
ExecutionRule.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/ExecutionRule.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import javax.annotation.Generated;
@Generated("xs2a-adapter-codegen")
public enum ExecutionRule {
FOLLOWING("following"),
PRECEDING("preceding");
private String value;
ExecutionRule(String value) {
this.value = value;
}
@JsonCreator
public static ExecutionRule fromValue(String value) {
for (ExecutionRule e : ExecutionRule.values()) {
if (e.value.equals(value)) {
return e;
}
}
return null;
}
@Override
@JsonValue
public String toString() {
return value;
}
}
| 1,573 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
PurposeCode.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/PurposeCode.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import javax.annotation.Generated;
@Generated("xs2a-adapter-codegen")
public enum PurposeCode {
BKDF("BKDF"),
BKFE("BKFE"),
BKFM("BKFM"),
BKIP("BKIP"),
BKPP("BKPP"),
CBLK("CBLK"),
CDCB("CDCB"),
CDCD("CDCD"),
CDCS("CDCS"),
CDDP("CDDP"),
CDOC("CDOC"),
CDQC("CDQC"),
ETUP("ETUP"),
FCOL("FCOL"),
MTUP("MTUP"),
ACCT("ACCT"),
CASH("CASH"),
COLL("COLL"),
CSDB("CSDB"),
DEPT("DEPT"),
INTC("INTC"),
LIMA("LIMA"),
NETT("NETT"),
BFWD("BFWD"),
CCIR("CCIR"),
CCPC("CCPC"),
CCPM("CCPM"),
CCSM("CCSM"),
CRDS("CRDS"),
CRPR("CRPR"),
CRSP("CRSP"),
CRTL("CRTL"),
EQPT("EQPT"),
EQUS("EQUS"),
EXPT("EXPT"),
EXTD("EXTD"),
FIXI("FIXI"),
FWBC("FWBC"),
FWCC("FWCC"),
FWSB("FWSB"),
FWSC("FWSC"),
MARG("MARG"),
MBSB("MBSB"),
MBSC("MBSC"),
MGCC("MGCC"),
MGSC("MGSC"),
OCCC("OCCC"),
OPBC("OPBC"),
OPCC("OPCC"),
OPSB("OPSB"),
OPSC("OPSC"),
OPTN("OPTN"),
OTCD("OTCD"),
REPO("REPO"),
RPBC("RPBC"),
RPCC("RPCC"),
RPSB("RPSB"),
RPSC("RPSC"),
RVPO("RVPO"),
SBSC("SBSC"),
SCIE("SCIE"),
SCIR("SCIR"),
SCRP("SCRP"),
SHBC("SHBC"),
SHCC("SHCC"),
SHSL("SHSL"),
SLEB("SLEB"),
SLOA("SLOA"),
SWBC("SWBC"),
SWCC("SWCC"),
SWPT("SWPT"),
SWSB("SWSB"),
SWSC("SWSC"),
TBAS("TBAS"),
TBBC("TBBC"),
TBCC("TBCC"),
TRCP("TRCP"),
AGRT("AGRT"),
AREN("AREN"),
BEXP("BEXP"),
BOCE("BOCE"),
COMC("COMC"),
CPYR("CPYR"),
GDDS("GDDS"),
GDSV("GDSV"),
GSCB("GSCB"),
LICF("LICF"),
MP2B("MP2B"),
POPE("POPE"),
ROYA("ROYA"),
SCVE("SCVE"),
SERV("SERV"),
SUBS("SUBS"),
SUPP("SUPP"),
TRAD("TRAD"),
CHAR("CHAR"),
COMT("COMT"),
MP2P("MP2P"),
ECPG("ECPG"),
ECPR("ECPR"),
ECPU("ECPU"),
EPAY("EPAY"),
CLPR("CLPR"),
COMP("COMP"),
DBTC("DBTC"),
GOVI("GOVI"),
HLRP("HLRP"),
HLST("HLST"),
INPC("INPC"),
INPR("INPR"),
INSC("INSC"),
INSU("INSU"),
INTE("INTE"),
LBRI("LBRI"),
LIFI("LIFI"),
LOAN("LOAN"),
LOAR("LOAR"),
PENO("PENO"),
PPTI("PPTI"),
RELG("RELG"),
RINP("RINP"),
TRFD("TRFD"),
FORW("FORW"),
FXNT("FXNT"),
ADMG("ADMG"),
ADVA("ADVA"),
BCDM("BCDM"),
BCFG("BCFG"),
BLDM("BLDM"),
BNET("BNET"),
CBFF("CBFF"),
CBFR("CBFR"),
CCRD("CCRD"),
CDBL("CDBL"),
CFEE("CFEE"),
CGDD("CGDD"),
CORT("CORT"),
COST("COST"),
CPKC("CPKC"),
DCRD("DCRD"),
DSMT("DSMT"),
DVPM("DVPM"),
EDUC("EDUC"),
FACT("FACT"),
FAND("FAND"),
FCPM("FCPM"),
FEES("FEES"),
GOVT("GOVT"),
ICCP("ICCP"),
IDCP("IDCP"),
IHRP("IHRP"),
INSM("INSM"),
IVPT("IVPT"),
MCDM("MCDM"),
MCFG("MCFG"),
MSVC("MSVC"),
NOWS("NOWS"),
OCDM("OCDM"),
OCFG("OCFG"),
OFEE("OFEE"),
OTHR("OTHR"),
PADD("PADD"),
PTSP("PTSP"),
RCKE("RCKE"),
RCPT("RCPT"),
REBT("REBT"),
REFU("REFU"),
RENT("RENT"),
REOD("REOD"),
RIMB("RIMB"),
RPNT("RPNT"),
RRBN("RRBN"),
RVPM("RVPM"),
SLPI("SLPI"),
SPLT("SPLT"),
STDY("STDY"),
TBAN("TBAN"),
TBIL("TBIL"),
TCSC("TCSC"),
TELI("TELI"),
TMPG("TMPG"),
TPRI("TPRI"),
TPRP("TPRP"),
TRNC("TRNC"),
TRVC("TRVC"),
WEBI("WEBI"),
ANNI("ANNI"),
CAFI("CAFI"),
CFDI("CFDI"),
CMDT("CMDT"),
DERI("DERI"),
DIVD("DIVD"),
FREX("FREX"),
HEDG("HEDG"),
INVS("INVS"),
PRME("PRME"),
SAVG("SAVG"),
SECU("SECU"),
SEPI("SEPI"),
TREA("TREA"),
UNIT("UNIT"),
FNET("FNET"),
FUTR("FUTR"),
ANTS("ANTS"),
CVCF("CVCF"),
DMEQ("DMEQ"),
DNTS("DNTS"),
HLTC("HLTC"),
HLTI("HLTI"),
HSPC("HSPC"),
ICRF("ICRF"),
LTCF("LTCF"),
MAFC("MAFC"),
MARF("MARF"),
MDCS("MDCS"),
VIEW("VIEW"),
CDEP("CDEP"),
SWFP("SWFP"),
SWPP("SWPP"),
SWRS("SWRS"),
SWUF("SWUF"),
ADCS("ADCS"),
AEMP("AEMP"),
ALLW("ALLW"),
ALMY("ALMY"),
BBSC("BBSC"),
BECH("BECH"),
BENE("BENE"),
BONU("BONU"),
CCHD("CCHD"),
COMM("COMM"),
CSLP("CSLP"),
GFRP("GFRP"),
GVEA("GVEA"),
GVEB("GVEB"),
GVEC("GVEC"),
GVED("GVED"),
GWLT("GWLT"),
HREC("HREC"),
PAYR("PAYR"),
PEFC("PEFC"),
PENS("PENS"),
PRCP("PRCP"),
RHBS("RHBS"),
SALA("SALA"),
SSBE("SSBE"),
LBIN("LBIN"),
LCOL("LCOL"),
LFEE("LFEE"),
LMEQ("LMEQ"),
LMFI("LMFI"),
LMRK("LMRK"),
LREB("LREB"),
LREV("LREV"),
LSFL("LSFL"),
ESTX("ESTX"),
FWLV("FWLV"),
GSTX("GSTX"),
HSTX("HSTX"),
INTX("INTX"),
NITX("NITX"),
PTXP("PTXP"),
RDTX("RDTX"),
TAXS("TAXS"),
VATX("VATX"),
WHLD("WHLD"),
TAXR("TAXR"),
B112("B112"),
BR12("BR12"),
TLRF("TLRF"),
TLRR("TLRR"),
AIRB("AIRB"),
BUSB("BUSB"),
FERB("FERB"),
RLWY("RLWY"),
TRPT("TRPT"),
CBTV("CBTV"),
ELEC("ELEC"),
ENRG("ENRG"),
GASB("GASB"),
NWCH("NWCH"),
NWCM("NWCM"),
OTLC("OTLC"),
PHON("PHON"),
UBIL("UBIL"),
WTER("WTER");
private String value;
PurposeCode(String value) {
this.value = value;
}
@JsonCreator
public static PurposeCode fromValue(String value) {
for (PurposeCode e : PurposeCode.values()) {
if (e.value.equals(value)) {
return e;
}
}
return null;
}
@Override
@JsonValue
public String toString() {
return value;
}
}
| 6,939 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
ChargeBearer.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/ChargeBearer.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import javax.annotation.Generated;
@Generated("xs2a-adapter-codegen")
public enum ChargeBearer {
DEBT("DEBT"),
CRED("CRED"),
SHAR("SHAR"),
SLEV("SLEV");
private String value;
ChargeBearer(String value) {
this.value = value;
}
@JsonCreator
public static ChargeBearer fromValue(String value) {
for (ChargeBearer e : ChargeBearer.values()) {
if (e.value.equals(value)) {
return e;
}
}
return null;
}
@Override
@JsonValue
public String toString() {
return value;
}
}
| 1,586 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
ErrorResponse.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/ErrorResponse.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import javax.annotation.Generated;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class ErrorResponse {
private List<TppMessage> tppMessages;
@JsonProperty("_links")
private Map<String, HrefType> links;
public List<TppMessage> getTppMessages() {
return tppMessages;
}
public void setTppMessages(List<TppMessage> tppMessages) {
this.tppMessages = tppMessages;
}
public Map<String, HrefType> getLinks() {
return links;
}
public void setLinks(Map<String, HrefType> links) {
this.links = links;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ErrorResponse that = (ErrorResponse) o;
return Objects.equals(tppMessages, that.tppMessages) &&
Objects.equals(links, that.links);
}
@Override
public int hashCode() {
return Objects.hash(tppMessages,
links);
}
}
| 2,003 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
AccountReport.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/AccountReport.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import javax.annotation.Generated;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class AccountReport {
private List<Transactions> booked;
private List<Transactions> pending;
private List<Transactions> information;
@JsonProperty("_links")
private Map<String, HrefType> links;
public List<Transactions> getBooked() {
return booked;
}
public void setBooked(List<Transactions> booked) {
this.booked = booked;
}
public List<Transactions> getPending() {
return pending;
}
public void setPending(List<Transactions> pending) {
this.pending = pending;
}
public List<Transactions> getInformation() {
return information;
}
public void setInformation(List<Transactions> information) {
this.information = information;
}
public Map<String, HrefType> getLinks() {
return links;
}
public void setLinks(Map<String, HrefType> links) {
this.links = links;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AccountReport that = (AccountReport) o;
return Objects.equals(booked, that.booked) &&
Objects.equals(pending, that.pending) &&
Objects.equals(information, that.information) &&
Objects.equals(links, that.links);
}
@Override
public int hashCode() {
return Objects.hash(booked,
pending,
information,
links);
}
}
| 2,573 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
EntryDetailsElement.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/EntryDetailsElement.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import javax.annotation.Generated;
import java.util.List;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class EntryDetailsElement {
private String endToEndId;
private String mandateId;
private String checkId;
private String creditorId;
private Amount transactionAmount;
private List<ReportExchangeRate> currencyExchange;
private String creditorName;
private AccountReference creditorAccount;
private String creditorAgent;
private String ultimateCreditor;
private String debtorName;
private AccountReference debtorAccount;
private String debtorAgent;
private String ultimateDebtor;
private String remittanceInformationUnstructured;
private List<String> remittanceInformationUnstructuredArray;
private String remittanceInformationStructured;
private List<String> remittanceInformationStructuredArray;
private PurposeCode purposeCode;
public String getEndToEndId() {
return endToEndId;
}
public void setEndToEndId(String endToEndId) {
this.endToEndId = endToEndId;
}
public String getMandateId() {
return mandateId;
}
public void setMandateId(String mandateId) {
this.mandateId = mandateId;
}
public String getCheckId() {
return checkId;
}
public void setCheckId(String checkId) {
this.checkId = checkId;
}
public String getCreditorId() {
return creditorId;
}
public void setCreditorId(String creditorId) {
this.creditorId = creditorId;
}
public Amount getTransactionAmount() {
return transactionAmount;
}
public void setTransactionAmount(Amount transactionAmount) {
this.transactionAmount = transactionAmount;
}
public List<ReportExchangeRate> getCurrencyExchange() {
return currencyExchange;
}
public void setCurrencyExchange(List<ReportExchangeRate> currencyExchange) {
this.currencyExchange = currencyExchange;
}
public String getCreditorName() {
return creditorName;
}
public void setCreditorName(String creditorName) {
this.creditorName = creditorName;
}
public AccountReference getCreditorAccount() {
return creditorAccount;
}
public void setCreditorAccount(AccountReference creditorAccount) {
this.creditorAccount = creditorAccount;
}
public String getCreditorAgent() {
return creditorAgent;
}
public void setCreditorAgent(String creditorAgent) {
this.creditorAgent = creditorAgent;
}
public String getUltimateCreditor() {
return ultimateCreditor;
}
public void setUltimateCreditor(String ultimateCreditor) {
this.ultimateCreditor = ultimateCreditor;
}
public String getDebtorName() {
return debtorName;
}
public void setDebtorName(String debtorName) {
this.debtorName = debtorName;
}
public AccountReference getDebtorAccount() {
return debtorAccount;
}
public void setDebtorAccount(AccountReference debtorAccount) {
this.debtorAccount = debtorAccount;
}
public String getDebtorAgent() {
return debtorAgent;
}
public void setDebtorAgent(String debtorAgent) {
this.debtorAgent = debtorAgent;
}
public String getUltimateDebtor() {
return ultimateDebtor;
}
public void setUltimateDebtor(String ultimateDebtor) {
this.ultimateDebtor = ultimateDebtor;
}
public String getRemittanceInformationUnstructured() {
return remittanceInformationUnstructured;
}
public void setRemittanceInformationUnstructured(String remittanceInformationUnstructured) {
this.remittanceInformationUnstructured = remittanceInformationUnstructured;
}
public List<String> getRemittanceInformationUnstructuredArray() {
return remittanceInformationUnstructuredArray;
}
public void setRemittanceInformationUnstructuredArray(
List<String> remittanceInformationUnstructuredArray) {
this.remittanceInformationUnstructuredArray = remittanceInformationUnstructuredArray;
}
public String getRemittanceInformationStructured() {
return remittanceInformationStructured;
}
public void setRemittanceInformationStructured(String remittanceInformationStructured) {
this.remittanceInformationStructured = remittanceInformationStructured;
}
public List<String> getRemittanceInformationStructuredArray() {
return remittanceInformationStructuredArray;
}
public void setRemittanceInformationStructuredArray(
List<String> remittanceInformationStructuredArray) {
this.remittanceInformationStructuredArray = remittanceInformationStructuredArray;
}
public PurposeCode getPurposeCode() {
return purposeCode;
}
public void setPurposeCode(PurposeCode purposeCode) {
this.purposeCode = purposeCode;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
EntryDetailsElement that = (EntryDetailsElement) o;
return Objects.equals(endToEndId, that.endToEndId) &&
Objects.equals(mandateId, that.mandateId) &&
Objects.equals(checkId, that.checkId) &&
Objects.equals(creditorId, that.creditorId) &&
Objects.equals(transactionAmount, that.transactionAmount) &&
Objects.equals(currencyExchange, that.currencyExchange) &&
Objects.equals(creditorName, that.creditorName) &&
Objects.equals(creditorAccount, that.creditorAccount) &&
Objects.equals(creditorAgent, that.creditorAgent) &&
Objects.equals(ultimateCreditor, that.ultimateCreditor) &&
Objects.equals(debtorName, that.debtorName) &&
Objects.equals(debtorAccount, that.debtorAccount) &&
Objects.equals(debtorAgent, that.debtorAgent) &&
Objects.equals(ultimateDebtor, that.ultimateDebtor) &&
Objects.equals(remittanceInformationUnstructured, that.remittanceInformationUnstructured) &&
Objects.equals(remittanceInformationUnstructuredArray, that.remittanceInformationUnstructuredArray) &&
Objects.equals(remittanceInformationStructured, that.remittanceInformationStructured) &&
Objects.equals(remittanceInformationStructuredArray, that.remittanceInformationStructuredArray) &&
Objects.equals(purposeCode, that.purposeCode);
}
@Override
public int hashCode() {
return Objects.hash(endToEndId,
mandateId,
checkId,
creditorId,
transactionAmount,
currencyExchange,
creditorName,
creditorAccount,
creditorAgent,
ultimateCreditor,
debtorName,
debtorAccount,
debtorAgent,
ultimateDebtor,
remittanceInformationUnstructured,
remittanceInformationUnstructuredArray,
remittanceInformationStructured,
remittanceInformationStructuredArray,
purposeCode);
}
}
| 8,161 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
MessageCode200InitiationStatus.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/MessageCode200InitiationStatus.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import javax.annotation.Generated;
@Generated("xs2a-adapter-codegen")
public enum MessageCode200InitiationStatus {
FUNDS_NOT_AVAILABLE("FUNDS_NOT_AVAILABLE");
private String value;
MessageCode200InitiationStatus(String value) {
this.value = value;
}
@JsonCreator
public static MessageCode200InitiationStatus fromValue(String value) {
for (MessageCode200InitiationStatus e : MessageCode200InitiationStatus.values()) {
if (e.value.equals(value)) {
return e;
}
}
return null;
}
@Override
@JsonValue
public String toString() {
return value;
}
}
| 1,649 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
AccountReference.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/AccountReference.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import javax.annotation.Generated;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class AccountReference {
private String iban;
private String bban;
private String pan;
private String maskedPan;
private String msisdn;
private String currency;
private String otherAccountIdentification;
public String getIban() {
return iban;
}
public void setIban(String iban) {
this.iban = iban;
}
public String getBban() {
return bban;
}
public void setBban(String bban) {
this.bban = bban;
}
public String getPan() {
return pan;
}
public void setPan(String pan) {
this.pan = pan;
}
public String getMaskedPan() {
return maskedPan;
}
public void setMaskedPan(String maskedPan) {
this.maskedPan = maskedPan;
}
public String getMsisdn() {
return msisdn;
}
public void setMsisdn(String msisdn) {
this.msisdn = msisdn;
}
public String getCurrency() {
return currency;
}
public void setCurrency(String currency) {
this.currency = currency;
}
public String getOtherAccountIdentification() {
return otherAccountIdentification;
}
public void setOtherAccountIdentification(String otherAccountIdentification) {
this.otherAccountIdentification = otherAccountIdentification;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AccountReference that = (AccountReference) o;
return Objects.equals(iban, that.iban) &&
Objects.equals(bban, that.bban) &&
Objects.equals(pan, that.pan) &&
Objects.equals(maskedPan, that.maskedPan) &&
Objects.equals(msisdn, that.msisdn) &&
Objects.equals(currency, that.currency) &&
Objects.equals(otherAccountIdentification, that.otherAccountIdentification);
}
@Override
public int hashCode() {
return Objects.hash(iban,
bban,
pan,
maskedPan,
msisdn,
currency,
otherAccountIdentification);
}
}
| 3,154 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
TppMessage.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/TppMessage.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import javax.annotation.Generated;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class TppMessage {
private TppMessageCategory category;
private String code;
private String path;
private String text;
public TppMessageCategory getCategory() {
return category;
}
public void setCategory(TppMessageCategory category) {
this.category = category;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TppMessage that = (TppMessage) o;
return Objects.equals(category, that.category) &&
Objects.equals(code, that.code) &&
Objects.equals(path, that.path) &&
Objects.equals(text, that.text);
}
@Override
public int hashCode() {
return Objects.hash(category,
code,
path,
text);
}
}
| 2,229 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
PeriodicPaymentInitiationMultipartBody.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/PeriodicPaymentInitiationMultipartBody.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import javax.annotation.Generated;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class PeriodicPaymentInitiationMultipartBody {
private Object xml_sct;
private PeriodicPaymentInitiationXmlPart2StandingorderTypeJson json_standingorderType;
public Object getXml_sct() {
return xml_sct;
}
public void setXml_sct(Object xml_sct) {
this.xml_sct = xml_sct;
}
public PeriodicPaymentInitiationXmlPart2StandingorderTypeJson getJson_standingorderType() {
return json_standingorderType;
}
public void setJson_standingorderType(
PeriodicPaymentInitiationXmlPart2StandingorderTypeJson json_standingorderType) {
this.json_standingorderType = json_standingorderType;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PeriodicPaymentInitiationMultipartBody that = (PeriodicPaymentInitiationMultipartBody) o;
return Objects.equals(xml_sct, that.xml_sct) &&
Objects.equals(json_standingorderType, that.json_standingorderType);
}
@Override
public int hashCode() {
return Objects.hash(xml_sct,
json_standingorderType);
}
}
| 2,158 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
SelectPsuAuthenticationMethodResponse.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/SelectPsuAuthenticationMethodResponse.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import javax.annotation.Generated;
import java.util.Map;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class SelectPsuAuthenticationMethodResponse {
private Amount transactionFees;
private Amount currencyConversionFees;
private Amount estimatedTotalAmount;
private Amount estimatedInterbankSettlementAmount;
private Object chosenScaMethod;
private ChallengeData challengeData;
@JsonProperty("_links")
private Map<String, HrefType> links;
private ScaStatus scaStatus;
private String psuMessage;
public Amount getTransactionFees() {
return transactionFees;
}
public void setTransactionFees(Amount transactionFees) {
this.transactionFees = transactionFees;
}
public Amount getCurrencyConversionFees() {
return currencyConversionFees;
}
public void setCurrencyConversionFees(Amount currencyConversionFees) {
this.currencyConversionFees = currencyConversionFees;
}
public Amount getEstimatedTotalAmount() {
return estimatedTotalAmount;
}
public void setEstimatedTotalAmount(Amount estimatedTotalAmount) {
this.estimatedTotalAmount = estimatedTotalAmount;
}
public Amount getEstimatedInterbankSettlementAmount() {
return estimatedInterbankSettlementAmount;
}
public void setEstimatedInterbankSettlementAmount(Amount estimatedInterbankSettlementAmount) {
this.estimatedInterbankSettlementAmount = estimatedInterbankSettlementAmount;
}
public Object getChosenScaMethod() {
return chosenScaMethod;
}
public void setChosenScaMethod(Object chosenScaMethod) {
this.chosenScaMethod = chosenScaMethod;
}
public ChallengeData getChallengeData() {
return challengeData;
}
public void setChallengeData(ChallengeData challengeData) {
this.challengeData = challengeData;
}
public Map<String, HrefType> getLinks() {
return links;
}
public void setLinks(Map<String, HrefType> links) {
this.links = links;
}
public ScaStatus getScaStatus() {
return scaStatus;
}
public void setScaStatus(ScaStatus scaStatus) {
this.scaStatus = scaStatus;
}
public String getPsuMessage() {
return psuMessage;
}
public void setPsuMessage(String psuMessage) {
this.psuMessage = psuMessage;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
SelectPsuAuthenticationMethodResponse that = (SelectPsuAuthenticationMethodResponse) o;
return Objects.equals(transactionFees, that.transactionFees) &&
Objects.equals(currencyConversionFees, that.currencyConversionFees) &&
Objects.equals(estimatedTotalAmount, that.estimatedTotalAmount) &&
Objects.equals(estimatedInterbankSettlementAmount, that.estimatedInterbankSettlementAmount) &&
Objects.equals(chosenScaMethod, that.chosenScaMethod) &&
Objects.equals(challengeData, that.challengeData) &&
Objects.equals(links, that.links) &&
Objects.equals(scaStatus, that.scaStatus) &&
Objects.equals(psuMessage, that.psuMessage);
}
@Override
public int hashCode() {
return Objects.hash(transactionFees,
currencyConversionFees,
estimatedTotalAmount,
estimatedInterbankSettlementAmount,
chosenScaMethod,
challengeData,
links,
scaStatus,
psuMessage);
}
}
| 4,589 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
UpdatePsuAuthenticationResponse.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/UpdatePsuAuthenticationResponse.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import javax.annotation.Generated;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class UpdatePsuAuthenticationResponse {
private Amount transactionFees;
private Amount currencyConversionFees;
private Amount estimatedTotalAmount;
private Amount estimatedInterbankSettlementAmount;
private Object chosenScaMethod;
private ChallengeData challengeData;
private List<AuthenticationObject> scaMethods;
@JsonProperty("_links")
private Map<String, HrefType> links;
private ScaStatus scaStatus;
private String psuMessage;
private String authorisationId;
public Amount getTransactionFees() {
return transactionFees;
}
public void setTransactionFees(Amount transactionFees) {
this.transactionFees = transactionFees;
}
public Amount getCurrencyConversionFees() {
return currencyConversionFees;
}
public void setCurrencyConversionFees(Amount currencyConversionFees) {
this.currencyConversionFees = currencyConversionFees;
}
public Amount getEstimatedTotalAmount() {
return estimatedTotalAmount;
}
public void setEstimatedTotalAmount(Amount estimatedTotalAmount) {
this.estimatedTotalAmount = estimatedTotalAmount;
}
public Amount getEstimatedInterbankSettlementAmount() {
return estimatedInterbankSettlementAmount;
}
public void setEstimatedInterbankSettlementAmount(Amount estimatedInterbankSettlementAmount) {
this.estimatedInterbankSettlementAmount = estimatedInterbankSettlementAmount;
}
public Object getChosenScaMethod() {
return chosenScaMethod;
}
public void setChosenScaMethod(Object chosenScaMethod) {
this.chosenScaMethod = chosenScaMethod;
}
public ChallengeData getChallengeData() {
return challengeData;
}
public void setChallengeData(ChallengeData challengeData) {
this.challengeData = challengeData;
}
public List<AuthenticationObject> getScaMethods() {
return scaMethods;
}
public void setScaMethods(List<AuthenticationObject> scaMethods) {
this.scaMethods = scaMethods;
}
public Map<String, HrefType> getLinks() {
return links;
}
public void setLinks(Map<String, HrefType> links) {
this.links = links;
}
public ScaStatus getScaStatus() {
return scaStatus;
}
public void setScaStatus(ScaStatus scaStatus) {
this.scaStatus = scaStatus;
}
public String getPsuMessage() {
return psuMessage;
}
public void setPsuMessage(String psuMessage) {
this.psuMessage = psuMessage;
}
public String getAuthorisationId() {
return authorisationId;
}
public void setAuthorisationId(String authorisationId) {
this.authorisationId = authorisationId;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
UpdatePsuAuthenticationResponse that = (UpdatePsuAuthenticationResponse) o;
return Objects.equals(transactionFees, that.transactionFees) &&
Objects.equals(currencyConversionFees, that.currencyConversionFees) &&
Objects.equals(estimatedTotalAmount, that.estimatedTotalAmount) &&
Objects.equals(estimatedInterbankSettlementAmount, that.estimatedInterbankSettlementAmount) &&
Objects.equals(chosenScaMethod, that.chosenScaMethod) &&
Objects.equals(challengeData, that.challengeData) &&
Objects.equals(scaMethods, that.scaMethods) &&
Objects.equals(links, that.links) &&
Objects.equals(scaStatus, that.scaStatus) &&
Objects.equals(psuMessage, that.psuMessage) &&
Objects.equals(authorisationId, that.authorisationId);
}
@Override
public int hashCode() {
return Objects.hash(transactionFees,
currencyConversionFees,
estimatedTotalAmount,
estimatedInterbankSettlementAmount,
chosenScaMethod,
challengeData,
scaMethods,
links,
scaStatus,
psuMessage,
authorisationId);
}
}
| 5,266 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
ReportExchangeRate.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/ReportExchangeRate.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import javax.annotation.Generated;
import java.time.LocalDate;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class ReportExchangeRate {
private String sourceCurrency;
private String exchangeRate;
private String unitCurrency;
private String targetCurrency;
private LocalDate quotationDate;
private String contractIdentification;
public String getSourceCurrency() {
return sourceCurrency;
}
public void setSourceCurrency(String sourceCurrency) {
this.sourceCurrency = sourceCurrency;
}
public String getExchangeRate() {
return exchangeRate;
}
public void setExchangeRate(String exchangeRate) {
this.exchangeRate = exchangeRate;
}
public String getUnitCurrency() {
return unitCurrency;
}
public void setUnitCurrency(String unitCurrency) {
this.unitCurrency = unitCurrency;
}
public String getTargetCurrency() {
return targetCurrency;
}
public void setTargetCurrency(String targetCurrency) {
this.targetCurrency = targetCurrency;
}
public LocalDate getQuotationDate() {
return quotationDate;
}
public void setQuotationDate(LocalDate quotationDate) {
this.quotationDate = quotationDate;
}
public String getContractIdentification() {
return contractIdentification;
}
public void setContractIdentification(String contractIdentification) {
this.contractIdentification = contractIdentification;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ReportExchangeRate that = (ReportExchangeRate) o;
return Objects.equals(sourceCurrency, that.sourceCurrency) &&
Objects.equals(exchangeRate, that.exchangeRate) &&
Objects.equals(unitCurrency, that.unitCurrency) &&
Objects.equals(targetCurrency, that.targetCurrency) &&
Objects.equals(quotationDate, that.quotationDate) &&
Objects.equals(contractIdentification, that.contractIdentification);
}
@Override
public int hashCode() {
return Objects.hash(sourceCurrency,
exchangeRate,
unitCurrency,
targetCurrency,
quotationDate,
contractIdentification);
}
}
| 3,286 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
Transactions.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/Transactions.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import javax.annotation.Generated;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class Transactions {
private String transactionId;
private String entryReference;
private String endToEndId;
private Boolean batchIndicator;
private Integer batchNumberOfTransactions;
private String mandateId;
private String checkId;
private String creditorId;
private LocalDate bookingDate;
private LocalDate valueDate;
private Amount transactionAmount;
private List<ReportExchangeRate> currencyExchange;
private String creditorName;
private AccountReference creditorAccount;
private String creditorAgent;
private String ultimateCreditor;
private String debtorName;
private AccountReference debtorAccount;
private String debtorAgent;
private String ultimateDebtor;
private String remittanceInformationUnstructured;
private List<String> remittanceInformationUnstructuredArray;
private String remittanceInformationStructured;
private List<String> remittanceInformationStructuredArray;
private List<EntryDetailsElement> entryDetails;
private String additionalInformation;
private AdditionalInformationStructured additionalInformationStructured;
private PurposeCode purposeCode;
private String bankTransactionCode;
private String proprietaryBankTransactionCode;
private Balance balanceAfterTransaction;
@JsonProperty("_links")
private Map<String, HrefType> links;
public String getTransactionId() {
return transactionId;
}
public void setTransactionId(String transactionId) {
this.transactionId = transactionId;
}
public String getEntryReference() {
return entryReference;
}
public void setEntryReference(String entryReference) {
this.entryReference = entryReference;
}
public String getEndToEndId() {
return endToEndId;
}
public void setEndToEndId(String endToEndId) {
this.endToEndId = endToEndId;
}
public Boolean getBatchIndicator() {
return batchIndicator;
}
public void setBatchIndicator(Boolean batchIndicator) {
this.batchIndicator = batchIndicator;
}
public Integer getBatchNumberOfTransactions() {
return batchNumberOfTransactions;
}
public void setBatchNumberOfTransactions(Integer batchNumberOfTransactions) {
this.batchNumberOfTransactions = batchNumberOfTransactions;
}
public String getMandateId() {
return mandateId;
}
public void setMandateId(String mandateId) {
this.mandateId = mandateId;
}
public String getCheckId() {
return checkId;
}
public void setCheckId(String checkId) {
this.checkId = checkId;
}
public String getCreditorId() {
return creditorId;
}
public void setCreditorId(String creditorId) {
this.creditorId = creditorId;
}
public LocalDate getBookingDate() {
return bookingDate;
}
public void setBookingDate(LocalDate bookingDate) {
this.bookingDate = bookingDate;
}
public LocalDate getValueDate() {
return valueDate;
}
public void setValueDate(LocalDate valueDate) {
this.valueDate = valueDate;
}
public Amount getTransactionAmount() {
return transactionAmount;
}
public void setTransactionAmount(Amount transactionAmount) {
this.transactionAmount = transactionAmount;
}
public List<ReportExchangeRate> getCurrencyExchange() {
return currencyExchange;
}
public void setCurrencyExchange(List<ReportExchangeRate> currencyExchange) {
this.currencyExchange = currencyExchange;
}
public String getCreditorName() {
return creditorName;
}
public void setCreditorName(String creditorName) {
this.creditorName = creditorName;
}
public AccountReference getCreditorAccount() {
return creditorAccount;
}
public void setCreditorAccount(AccountReference creditorAccount) {
this.creditorAccount = creditorAccount;
}
public String getCreditorAgent() {
return creditorAgent;
}
public void setCreditorAgent(String creditorAgent) {
this.creditorAgent = creditorAgent;
}
public String getUltimateCreditor() {
return ultimateCreditor;
}
public void setUltimateCreditor(String ultimateCreditor) {
this.ultimateCreditor = ultimateCreditor;
}
public String getDebtorName() {
return debtorName;
}
public void setDebtorName(String debtorName) {
this.debtorName = debtorName;
}
public AccountReference getDebtorAccount() {
return debtorAccount;
}
public void setDebtorAccount(AccountReference debtorAccount) {
this.debtorAccount = debtorAccount;
}
public String getDebtorAgent() {
return debtorAgent;
}
public void setDebtorAgent(String debtorAgent) {
this.debtorAgent = debtorAgent;
}
public String getUltimateDebtor() {
return ultimateDebtor;
}
public void setUltimateDebtor(String ultimateDebtor) {
this.ultimateDebtor = ultimateDebtor;
}
public String getRemittanceInformationUnstructured() {
return remittanceInformationUnstructured;
}
public void setRemittanceInformationUnstructured(String remittanceInformationUnstructured) {
this.remittanceInformationUnstructured = remittanceInformationUnstructured;
}
public List<String> getRemittanceInformationUnstructuredArray() {
return remittanceInformationUnstructuredArray;
}
public void setRemittanceInformationUnstructuredArray(
List<String> remittanceInformationUnstructuredArray) {
this.remittanceInformationUnstructuredArray = remittanceInformationUnstructuredArray;
}
public String getRemittanceInformationStructured() {
return remittanceInformationStructured;
}
public void setRemittanceInformationStructured(String remittanceInformationStructured) {
this.remittanceInformationStructured = remittanceInformationStructured;
}
public List<String> getRemittanceInformationStructuredArray() {
return remittanceInformationStructuredArray;
}
public void setRemittanceInformationStructuredArray(
List<String> remittanceInformationStructuredArray) {
this.remittanceInformationStructuredArray = remittanceInformationStructuredArray;
}
public List<EntryDetailsElement> getEntryDetails() {
return entryDetails;
}
public void setEntryDetails(List<EntryDetailsElement> entryDetails) {
this.entryDetails = entryDetails;
}
public String getAdditionalInformation() {
return additionalInformation;
}
public void setAdditionalInformation(String additionalInformation) {
this.additionalInformation = additionalInformation;
}
public AdditionalInformationStructured getAdditionalInformationStructured() {
return additionalInformationStructured;
}
public void setAdditionalInformationStructured(
AdditionalInformationStructured additionalInformationStructured) {
this.additionalInformationStructured = additionalInformationStructured;
}
public PurposeCode getPurposeCode() {
return purposeCode;
}
public void setPurposeCode(PurposeCode purposeCode) {
this.purposeCode = purposeCode;
}
public String getBankTransactionCode() {
return bankTransactionCode;
}
public void setBankTransactionCode(String bankTransactionCode) {
this.bankTransactionCode = bankTransactionCode;
}
public String getProprietaryBankTransactionCode() {
return proprietaryBankTransactionCode;
}
public void setProprietaryBankTransactionCode(String proprietaryBankTransactionCode) {
this.proprietaryBankTransactionCode = proprietaryBankTransactionCode;
}
public Balance getBalanceAfterTransaction() {
return balanceAfterTransaction;
}
public void setBalanceAfterTransaction(Balance balanceAfterTransaction) {
this.balanceAfterTransaction = balanceAfterTransaction;
}
public Map<String, HrefType> getLinks() {
return links;
}
public void setLinks(Map<String, HrefType> links) {
this.links = links;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Transactions that = (Transactions) o;
return Objects.equals(transactionId, that.transactionId) &&
Objects.equals(entryReference, that.entryReference) &&
Objects.equals(endToEndId, that.endToEndId) &&
Objects.equals(batchIndicator, that.batchIndicator) &&
Objects.equals(batchNumberOfTransactions, that.batchNumberOfTransactions) &&
Objects.equals(mandateId, that.mandateId) &&
Objects.equals(checkId, that.checkId) &&
Objects.equals(creditorId, that.creditorId) &&
Objects.equals(bookingDate, that.bookingDate) &&
Objects.equals(valueDate, that.valueDate) &&
Objects.equals(transactionAmount, that.transactionAmount) &&
Objects.equals(currencyExchange, that.currencyExchange) &&
Objects.equals(creditorName, that.creditorName) &&
Objects.equals(creditorAccount, that.creditorAccount) &&
Objects.equals(creditorAgent, that.creditorAgent) &&
Objects.equals(ultimateCreditor, that.ultimateCreditor) &&
Objects.equals(debtorName, that.debtorName) &&
Objects.equals(debtorAccount, that.debtorAccount) &&
Objects.equals(debtorAgent, that.debtorAgent) &&
Objects.equals(ultimateDebtor, that.ultimateDebtor) &&
Objects.equals(remittanceInformationUnstructured, that.remittanceInformationUnstructured) &&
Objects.equals(remittanceInformationUnstructuredArray, that.remittanceInformationUnstructuredArray) &&
Objects.equals(remittanceInformationStructured, that.remittanceInformationStructured) &&
Objects.equals(remittanceInformationStructuredArray, that.remittanceInformationStructuredArray) &&
Objects.equals(entryDetails, that.entryDetails) &&
Objects.equals(additionalInformation, that.additionalInformation) &&
Objects.equals(additionalInformationStructured, that.additionalInformationStructured) &&
Objects.equals(purposeCode, that.purposeCode) &&
Objects.equals(bankTransactionCode, that.bankTransactionCode) &&
Objects.equals(proprietaryBankTransactionCode, that.proprietaryBankTransactionCode) &&
Objects.equals(balanceAfterTransaction, that.balanceAfterTransaction) &&
Objects.equals(links, that.links);
}
@Override
public int hashCode() {
return Objects.hash(transactionId,
entryReference,
endToEndId,
batchIndicator,
batchNumberOfTransactions,
mandateId,
checkId,
creditorId,
bookingDate,
valueDate,
transactionAmount,
currencyExchange,
creditorName,
creditorAccount,
creditorAgent,
ultimateCreditor,
debtorName,
debtorAccount,
debtorAgent,
ultimateDebtor,
remittanceInformationUnstructured,
remittanceInformationUnstructuredArray,
remittanceInformationStructured,
remittanceInformationStructuredArray,
entryDetails,
additionalInformation,
additionalInformationStructured,
purposeCode,
bankTransactionCode,
proprietaryBankTransactionCode,
balanceAfterTransaction,
links);
}
}
| 13,109 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
AuthorisationConfirmation.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/AuthorisationConfirmation.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import javax.annotation.Generated;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class AuthorisationConfirmation {
private String confirmationCode;
public String getConfirmationCode() {
return confirmationCode;
}
public void setConfirmationCode(String confirmationCode) {
this.confirmationCode = confirmationCode;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AuthorisationConfirmation that = (AuthorisationConfirmation) o;
return Objects.equals(confirmationCode, that.confirmationCode);
}
@Override
public int hashCode() {
return Objects.hash(confirmationCode);
}
}
| 1,655 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
PaymentInitiationBulkElementJson.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/PaymentInitiationBulkElementJson.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import javax.annotation.Generated;
import java.util.List;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class PaymentInitiationBulkElementJson {
private String endToEndIdentification;
private String instructionIdentification;
private String debtorName;
private String ultimateDebtor;
private Amount instructedAmount;
private AccountReference creditorAccount;
private String creditorAgent;
private String creditorAgentName;
private String creditorName;
private Address creditorAddress;
private String creditorId;
private String ultimateCreditor;
private PurposeCode purposeCode;
private ChargeBearer chargeBearer;
private String remittanceInformationUnstructured;
private String remittanceInformationStructured;
private List<String> remittanceInformationStructuredArray;
public String getEndToEndIdentification() {
return endToEndIdentification;
}
public void setEndToEndIdentification(String endToEndIdentification) {
this.endToEndIdentification = endToEndIdentification;
}
public String getInstructionIdentification() {
return instructionIdentification;
}
public void setInstructionIdentification(String instructionIdentification) {
this.instructionIdentification = instructionIdentification;
}
public String getDebtorName() {
return debtorName;
}
public void setDebtorName(String debtorName) {
this.debtorName = debtorName;
}
public String getUltimateDebtor() {
return ultimateDebtor;
}
public void setUltimateDebtor(String ultimateDebtor) {
this.ultimateDebtor = ultimateDebtor;
}
public Amount getInstructedAmount() {
return instructedAmount;
}
public void setInstructedAmount(Amount instructedAmount) {
this.instructedAmount = instructedAmount;
}
public AccountReference getCreditorAccount() {
return creditorAccount;
}
public void setCreditorAccount(AccountReference creditorAccount) {
this.creditorAccount = creditorAccount;
}
public String getCreditorAgent() {
return creditorAgent;
}
public void setCreditorAgent(String creditorAgent) {
this.creditorAgent = creditorAgent;
}
public String getCreditorAgentName() {
return creditorAgentName;
}
public void setCreditorAgentName(String creditorAgentName) {
this.creditorAgentName = creditorAgentName;
}
public String getCreditorName() {
return creditorName;
}
public void setCreditorName(String creditorName) {
this.creditorName = creditorName;
}
public Address getCreditorAddress() {
return creditorAddress;
}
public void setCreditorAddress(Address creditorAddress) {
this.creditorAddress = creditorAddress;
}
public String getCreditorId() {
return creditorId;
}
public void setCreditorId(String creditorId) {
this.creditorId = creditorId;
}
public String getUltimateCreditor() {
return ultimateCreditor;
}
public void setUltimateCreditor(String ultimateCreditor) {
this.ultimateCreditor = ultimateCreditor;
}
public PurposeCode getPurposeCode() {
return purposeCode;
}
public void setPurposeCode(PurposeCode purposeCode) {
this.purposeCode = purposeCode;
}
public ChargeBearer getChargeBearer() {
return chargeBearer;
}
public void setChargeBearer(ChargeBearer chargeBearer) {
this.chargeBearer = chargeBearer;
}
public String getRemittanceInformationUnstructured() {
return remittanceInformationUnstructured;
}
public void setRemittanceInformationUnstructured(String remittanceInformationUnstructured) {
this.remittanceInformationUnstructured = remittanceInformationUnstructured;
}
public String getRemittanceInformationStructured() {
return remittanceInformationStructured;
}
public void setRemittanceInformationStructured(String remittanceInformationStructured) {
this.remittanceInformationStructured = remittanceInformationStructured;
}
public List<String> getRemittanceInformationStructuredArray() {
return remittanceInformationStructuredArray;
}
public void setRemittanceInformationStructuredArray(
List<String> remittanceInformationStructuredArray) {
this.remittanceInformationStructuredArray = remittanceInformationStructuredArray;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PaymentInitiationBulkElementJson that = (PaymentInitiationBulkElementJson) o;
return Objects.equals(endToEndIdentification, that.endToEndIdentification) &&
Objects.equals(instructionIdentification, that.instructionIdentification) &&
Objects.equals(debtorName, that.debtorName) &&
Objects.equals(ultimateDebtor, that.ultimateDebtor) &&
Objects.equals(instructedAmount, that.instructedAmount) &&
Objects.equals(creditorAccount, that.creditorAccount) &&
Objects.equals(creditorAgent, that.creditorAgent) &&
Objects.equals(creditorAgentName, that.creditorAgentName) &&
Objects.equals(creditorName, that.creditorName) &&
Objects.equals(creditorAddress, that.creditorAddress) &&
Objects.equals(creditorId, that.creditorId) &&
Objects.equals(ultimateCreditor, that.ultimateCreditor) &&
Objects.equals(purposeCode, that.purposeCode) &&
Objects.equals(chargeBearer, that.chargeBearer) &&
Objects.equals(remittanceInformationUnstructured, that.remittanceInformationUnstructured) &&
Objects.equals(remittanceInformationStructured, that.remittanceInformationStructured) &&
Objects.equals(remittanceInformationStructuredArray, that.remittanceInformationStructuredArray);
}
@Override
public int hashCode() {
return Objects.hash(endToEndIdentification,
instructionIdentification,
debtorName,
ultimateDebtor,
instructedAmount,
creditorAccount,
creditorAgent,
creditorAgentName,
creditorName,
creditorAddress,
creditorId,
ultimateCreditor,
purposeCode,
chargeBearer,
remittanceInformationUnstructured,
remittanceInformationStructured,
remittanceInformationStructuredArray);
}
}
| 7,608 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
RemittanceInformationStructured.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/RemittanceInformationStructured.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import javax.annotation.Generated;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class RemittanceInformationStructured {
private String reference;
private String referenceType;
private String referenceIssuer;
public String getReference() {
return reference;
}
public void setReference(String reference) {
this.reference = reference;
}
public String getReferenceType() {
return referenceType;
}
public void setReferenceType(String referenceType) {
this.referenceType = referenceType;
}
public String getReferenceIssuer() {
return referenceIssuer;
}
public void setReferenceIssuer(String referenceIssuer) {
this.referenceIssuer = referenceIssuer;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
RemittanceInformationStructured that = (RemittanceInformationStructured) o;
return Objects.equals(reference, that.reference) &&
Objects.equals(referenceType, that.referenceType) &&
Objects.equals(referenceIssuer, that.referenceIssuer);
}
@Override
public int hashCode() {
return Objects.hash(reference,
referenceType,
referenceIssuer);
}
}
| 2,245 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
MessageCode2XX.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/MessageCode2XX.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import javax.annotation.Generated;
@Generated("xs2a-adapter-codegen")
public enum MessageCode2XX {
WARNING("WARNING");
private String value;
MessageCode2XX(String value) {
this.value = value;
}
@JsonCreator
public static MessageCode2XX fromValue(String value) {
for (MessageCode2XX e : MessageCode2XX.values()) {
if (e.value.equals(value)) {
return e;
}
}
return null;
}
@Override
@JsonValue
public String toString() {
return value;
}
}
| 1,545 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
Authorisations.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/Authorisations.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import javax.annotation.Generated;
import java.util.List;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class Authorisations {
private List<String> authorisationIds;
public List<String> getAuthorisationIds() {
return authorisationIds;
}
public void setAuthorisationIds(List<String> authorisationIds) {
this.authorisationIds = authorisationIds;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Authorisations that = (Authorisations) o;
return Objects.equals(authorisationIds, that.authorisationIds);
}
@Override
public int hashCode() {
return Objects.hash(authorisationIds);
}
}
| 1,663 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
TransactionStatus.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/TransactionStatus.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import javax.annotation.Generated;
@Generated("xs2a-adapter-codegen")
public enum TransactionStatus {
ACCC("ACCC"),
ACCP("ACCP"),
ACSC("ACSC"),
ACSP("ACSP"),
ACTC("ACTC"),
ACWC("ACWC"),
ACWP("ACWP"),
RCVD("RCVD"),
PDNG("PDNG"),
RJCT("RJCT"),
CANC("CANC"),
ACFC("ACFC"),
PATC("PATC"),
PART("PART");
private String value;
TransactionStatus(String value) {
this.value = value;
}
@JsonCreator
public static TransactionStatus fromValue(String value) {
for (TransactionStatus e : TransactionStatus.values()) {
if (e.value.equals(value)) {
return e;
}
}
return null;
}
@Override
@JsonValue
public String toString() {
return value;
}
}
| 1,801 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
PeriodicPaymentInitiationJson.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/PeriodicPaymentInitiationJson.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import javax.annotation.Generated;
import java.time.LocalDate;
import java.util.List;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class PeriodicPaymentInitiationJson {
private String endToEndIdentification;
private String instructionIdentification;
private String debtorName;
private AccountReference debtorAccount;
private String ultimateDebtor;
private Amount instructedAmount;
private AccountReference creditorAccount;
private String creditorAgent;
private String creditorId;
private String creditorName;
private Address creditorAddress;
private String ultimateCreditor;
private PurposeCode purposeCode;
private String remittanceInformationUnstructured;
private String remittanceInformationStructured;
private List<String> remittanceInformationStructuredArray;
private LocalDate startDate;
private LocalDate endDate;
private ExecutionRule executionRule;
private FrequencyCode frequency;
private DayOfExecution dayOfExecution;
public String getEndToEndIdentification() {
return endToEndIdentification;
}
public void setEndToEndIdentification(String endToEndIdentification) {
this.endToEndIdentification = endToEndIdentification;
}
public String getInstructionIdentification() {
return instructionIdentification;
}
public void setInstructionIdentification(String instructionIdentification) {
this.instructionIdentification = instructionIdentification;
}
public String getDebtorName() {
return debtorName;
}
public void setDebtorName(String debtorName) {
this.debtorName = debtorName;
}
public AccountReference getDebtorAccount() {
return debtorAccount;
}
public void setDebtorAccount(AccountReference debtorAccount) {
this.debtorAccount = debtorAccount;
}
public String getUltimateDebtor() {
return ultimateDebtor;
}
public void setUltimateDebtor(String ultimateDebtor) {
this.ultimateDebtor = ultimateDebtor;
}
public Amount getInstructedAmount() {
return instructedAmount;
}
public void setInstructedAmount(Amount instructedAmount) {
this.instructedAmount = instructedAmount;
}
public AccountReference getCreditorAccount() {
return creditorAccount;
}
public void setCreditorAccount(AccountReference creditorAccount) {
this.creditorAccount = creditorAccount;
}
public String getCreditorAgent() {
return creditorAgent;
}
public void setCreditorAgent(String creditorAgent) {
this.creditorAgent = creditorAgent;
}
public String getCreditorId() {
return creditorId;
}
public void setCreditorId(String creditorId) {
this.creditorId = creditorId;
}
public String getCreditorName() {
return creditorName;
}
public void setCreditorName(String creditorName) {
this.creditorName = creditorName;
}
public Address getCreditorAddress() {
return creditorAddress;
}
public void setCreditorAddress(Address creditorAddress) {
this.creditorAddress = creditorAddress;
}
public String getUltimateCreditor() {
return ultimateCreditor;
}
public void setUltimateCreditor(String ultimateCreditor) {
this.ultimateCreditor = ultimateCreditor;
}
public PurposeCode getPurposeCode() {
return purposeCode;
}
public void setPurposeCode(PurposeCode purposeCode) {
this.purposeCode = purposeCode;
}
public String getRemittanceInformationUnstructured() {
return remittanceInformationUnstructured;
}
public void setRemittanceInformationUnstructured(String remittanceInformationUnstructured) {
this.remittanceInformationUnstructured = remittanceInformationUnstructured;
}
public String getRemittanceInformationStructured() {
return remittanceInformationStructured;
}
public void setRemittanceInformationStructured(String remittanceInformationStructured) {
this.remittanceInformationStructured = remittanceInformationStructured;
}
public List<String> getRemittanceInformationStructuredArray() {
return remittanceInformationStructuredArray;
}
public void setRemittanceInformationStructuredArray(
List<String> remittanceInformationStructuredArray) {
this.remittanceInformationStructuredArray = remittanceInformationStructuredArray;
}
public LocalDate getStartDate() {
return startDate;
}
public void setStartDate(LocalDate startDate) {
this.startDate = startDate;
}
public LocalDate getEndDate() {
return endDate;
}
public void setEndDate(LocalDate endDate) {
this.endDate = endDate;
}
public ExecutionRule getExecutionRule() {
return executionRule;
}
public void setExecutionRule(ExecutionRule executionRule) {
this.executionRule = executionRule;
}
public FrequencyCode getFrequency() {
return frequency;
}
public void setFrequency(FrequencyCode frequency) {
this.frequency = frequency;
}
public DayOfExecution getDayOfExecution() {
return dayOfExecution;
}
public void setDayOfExecution(DayOfExecution dayOfExecution) {
this.dayOfExecution = dayOfExecution;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PeriodicPaymentInitiationJson that = (PeriodicPaymentInitiationJson) o;
return Objects.equals(endToEndIdentification, that.endToEndIdentification) &&
Objects.equals(instructionIdentification, that.instructionIdentification) &&
Objects.equals(debtorName, that.debtorName) &&
Objects.equals(debtorAccount, that.debtorAccount) &&
Objects.equals(ultimateDebtor, that.ultimateDebtor) &&
Objects.equals(instructedAmount, that.instructedAmount) &&
Objects.equals(creditorAccount, that.creditorAccount) &&
Objects.equals(creditorAgent, that.creditorAgent) &&
Objects.equals(creditorId, that.creditorId) &&
Objects.equals(creditorName, that.creditorName) &&
Objects.equals(creditorAddress, that.creditorAddress) &&
Objects.equals(ultimateCreditor, that.ultimateCreditor) &&
Objects.equals(purposeCode, that.purposeCode) &&
Objects.equals(remittanceInformationUnstructured, that.remittanceInformationUnstructured) &&
Objects.equals(remittanceInformationStructured, that.remittanceInformationStructured) &&
Objects.equals(remittanceInformationStructuredArray, that.remittanceInformationStructuredArray) &&
Objects.equals(startDate, that.startDate) &&
Objects.equals(endDate, that.endDate) &&
Objects.equals(executionRule, that.executionRule) &&
Objects.equals(frequency, that.frequency) &&
Objects.equals(dayOfExecution, that.dayOfExecution);
}
@Override
public int hashCode() {
return Objects.hash(endToEndIdentification,
instructionIdentification,
debtorName,
debtorAccount,
ultimateDebtor,
instructedAmount,
creditorAccount,
creditorAgent,
creditorId,
creditorName,
creditorAddress,
ultimateCreditor,
purposeCode,
remittanceInformationUnstructured,
remittanceInformationStructured,
remittanceInformationStructuredArray,
startDate,
endDate,
executionRule,
frequency,
dayOfExecution);
}
}
| 8,807 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
MessageCode.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/MessageCode.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import javax.annotation.Generated;
@Generated("xs2a-adapter-codegen")
public enum MessageCode {
FORMAT_ERROR("FORMAT_ERROR"),
PARAMETER_NOT_CONSISTENT("PARAMETER_NOT_CONSISTENT"),
PARAMETER_NOT_SUPPORTED("PARAMETER_NOT_SUPPORTED"),
SERVICE_INVALID("SERVICE_INVALID"),
RESOURCE_UNKNOWN("RESOURCE_UNKNOWN"),
RESOURCE_EXPIRED("RESOURCE_EXPIRED"),
RESOURCE_BLOCKED("RESOURCE_BLOCKED"),
TIMESTAMP_INVALID("TIMESTAMP_INVALID"),
PERIOD_INVALID("PERIOD_INVALID"),
SCA_METHOD_UNKNOWN("SCA_METHOD_UNKNOWN"),
SCA_INVALID("SCA_INVALID"),
CONSENT_UNKNOWN("CONSENT_UNKNOWN"),
SESSIONS_NOT_SUPPORTED("SESSIONS_NOT_SUPPORTED"),
PAYMENT_FAILED("PAYMENT_FAILED"),
EXECUTION_DATE_INVALID("EXECUTION_DATE_INVALID"),
CERTIFICATE_INVALID("CERTIFICATE_INVALID"),
ROLE_INVALID("ROLE_INVALID"),
CERTIFICATE_EXPIRED("CERTIFICATE_EXPIRED"),
CERTIFICATE_BLOCKED("CERTIFICATE_BLOCKED"),
CERTIFICATE_REVOKE("CERTIFICATE_REVOKE"),
CERTIFICATE_MISSING("CERTIFICATE_MISSING"),
SIGNATURE_INVALID("SIGNATURE_INVALID"),
SIGNATURE_MISSING("SIGNATURE_MISSING"),
CORPORATE_ID_INVALID("CORPORATE_ID_INVALID"),
PSU_CREDENTIALS_INVALID("PSU_CREDENTIALS_INVALID"),
CONSENT_INVALID("CONSENT_INVALID"),
CONSENT_EXPIRED("CONSENT_EXPIRED"),
TOKEN_UNKNOWN("TOKEN_UNKNOWN"),
TOKEN_INVALID("TOKEN_INVALID"),
TOKEN_EXPIRED("TOKEN_EXPIRED"),
REQUIRED_KID_MISSING("REQUIRED_KID_MISSING"),
SERVICE_BLOCKED("SERVICE_BLOCKED"),
PRODUCT_INVALID("PRODUCT_INVALID"),
PRODUCT_UNKNOWN("PRODUCT_UNKNOWN"),
REQUESTED_FORMATS_INVALID("REQUESTED_FORMATS_INVALID"),
STATUS_INVALID("STATUS_INVALID"),
ACCESS_EXCEEDED("ACCESS_EXCEEDED");
private String value;
MessageCode(String value) {
this.value = value;
}
@JsonCreator
public static MessageCode fromValue(String value) {
for (MessageCode e : MessageCode.values()) {
if (e.value.equals(value)) {
return e;
}
}
return null;
}
@Override
@JsonValue
public String toString() {
return value;
}
}
| 3,164 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
BulkPaymentInitiationWithStatusResponse.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/BulkPaymentInitiationWithStatusResponse.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import javax.annotation.Generated;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class BulkPaymentInitiationWithStatusResponse {
private Boolean batchBookingPreferred;
private LocalDate requestedExecutionDate;
private OffsetDateTime acceptorTransactionDateTime;
private AccountReference debtorAccount;
private String paymentInformationId;
private List<PaymentInitiationBulkElementJson> payments;
private TransactionStatus transactionStatus;
private List<TppMessageGeneric> tppMessage;
public Boolean getBatchBookingPreferred() {
return batchBookingPreferred;
}
public void setBatchBookingPreferred(Boolean batchBookingPreferred) {
this.batchBookingPreferred = batchBookingPreferred;
}
public LocalDate getRequestedExecutionDate() {
return requestedExecutionDate;
}
public void setRequestedExecutionDate(LocalDate requestedExecutionDate) {
this.requestedExecutionDate = requestedExecutionDate;
}
public OffsetDateTime getAcceptorTransactionDateTime() {
return acceptorTransactionDateTime;
}
public void setAcceptorTransactionDateTime(OffsetDateTime acceptorTransactionDateTime) {
this.acceptorTransactionDateTime = acceptorTransactionDateTime;
}
public AccountReference getDebtorAccount() {
return debtorAccount;
}
public void setDebtorAccount(AccountReference debtorAccount) {
this.debtorAccount = debtorAccount;
}
public String getPaymentInformationId() {
return paymentInformationId;
}
public void setPaymentInformationId(String paymentInformationId) {
this.paymentInformationId = paymentInformationId;
}
public List<PaymentInitiationBulkElementJson> getPayments() {
return payments;
}
public void setPayments(List<PaymentInitiationBulkElementJson> payments) {
this.payments = payments;
}
public TransactionStatus getTransactionStatus() {
return transactionStatus;
}
public void setTransactionStatus(TransactionStatus transactionStatus) {
this.transactionStatus = transactionStatus;
}
public List<TppMessageGeneric> getTppMessage() {
return tppMessage;
}
public void setTppMessage(List<TppMessageGeneric> tppMessage) {
this.tppMessage = tppMessage;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
BulkPaymentInitiationWithStatusResponse that = (BulkPaymentInitiationWithStatusResponse) o;
return Objects.equals(batchBookingPreferred, that.batchBookingPreferred) &&
Objects.equals(requestedExecutionDate, that.requestedExecutionDate) &&
Objects.equals(acceptorTransactionDateTime, that.acceptorTransactionDateTime) &&
Objects.equals(debtorAccount, that.debtorAccount) &&
Objects.equals(paymentInformationId, that.paymentInformationId) &&
Objects.equals(payments, that.payments) &&
Objects.equals(transactionStatus, that.transactionStatus) &&
Objects.equals(tppMessage, that.tppMessage);
}
@Override
public int hashCode() {
return Objects.hash(batchBookingPreferred,
requestedExecutionDate,
acceptorTransactionDateTime,
debtorAccount,
paymentInformationId,
payments,
transactionStatus,
tppMessage);
}
}
| 4,514 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
OK200CardAccountDetails.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/OK200CardAccountDetails.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import javax.annotation.Generated;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class OK200CardAccountDetails {
private CardAccountDetails cardAccount;
public CardAccountDetails getCardAccount() {
return cardAccount;
}
public void setCardAccount(CardAccountDetails cardAccount) {
this.cardAccount = cardAccount;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
OK200CardAccountDetails that = (OK200CardAccountDetails) o;
return Objects.equals(cardAccount, that.cardAccount);
}
@Override
public int hashCode() {
return Objects.hash(cardAccount);
}
}
| 1,635 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
PaymentProduct.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/PaymentProduct.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import javax.annotation.Generated;
@Generated("xs2a-adapter-codegen")
public enum PaymentProduct {
SEPA_CREDIT_TRANSFERS("sepa-credit-transfers"),
INSTANT_SEPA_CREDIT_TRANSFERS("instant-sepa-credit-transfers"),
TARGET_2_PAYMENTS("target-2-payments"),
CROSS_BORDER_CREDIT_TRANSFERS("cross-border-credit-transfers"),
PAIN_001_SEPA_CREDIT_TRANSFERS("pain.001-sepa-credit-transfers"),
PAIN_001_INSTANT_SEPA_CREDIT_TRANSFERS("pain.001-instant-sepa-credit-transfers"),
PAIN_001_TARGET_2_PAYMENTS("pain.001-target-2-payments"),
PAIN_001_CROSS_BORDER_CREDIT_TRANSFERS("pain.001-cross-border-credit-transfers");
private String value;
PaymentProduct(String value) {
this.value = value;
}
@JsonCreator
public static PaymentProduct fromValue(String value) {
for (PaymentProduct e : PaymentProduct.values()) {
if (e.value.equals(value)) {
return e;
}
}
return null;
}
@Override
@JsonValue
public String toString() {
return value;
}
}
| 2,064 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
OK200AccountDetails.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/OK200AccountDetails.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import javax.annotation.Generated;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class OK200AccountDetails {
private AccountDetails account;
public AccountDetails getAccount() {
return account;
}
public void setAccount(AccountDetails account) {
this.account = account;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
OK200AccountDetails that = (OK200AccountDetails) o;
return Objects.equals(account, that.account);
}
@Override
public int hashCode() {
return Objects.hash(account);
}
}
| 1,571 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
TppMessage2XX.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/TppMessage2XX.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import javax.annotation.Generated;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class TppMessage2XX {
private TppMessageCategory category;
private MessageCode2XX code;
private String path;
private String text;
public TppMessageCategory getCategory() {
return category;
}
public void setCategory(TppMessageCategory category) {
this.category = category;
}
public MessageCode2XX getCode() {
return code;
}
public void setCode(MessageCode2XX code) {
this.code = code;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TppMessage2XX that = (TppMessage2XX) o;
return Objects.equals(category, that.category) &&
Objects.equals(code, that.code) &&
Objects.equals(path, that.path) &&
Objects.equals(text, that.text);
}
@Override
public int hashCode() {
return Objects.hash(category,
code,
path,
text);
}
}
| 2,262 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
MessageCode201PaymentInitiation.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/MessageCode201PaymentInitiation.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import javax.annotation.Generated;
@Generated("xs2a-adapter-codegen")
public enum MessageCode201PaymentInitiation {
WARNING("WARNING"),
BENEFICIARY_WHITELISTING_REQUIRED("BENEFICIARY_WHITELISTING_REQUIRED");
private String value;
MessageCode201PaymentInitiation(String value) {
this.value = value;
}
@JsonCreator
public static MessageCode201PaymentInitiation fromValue(String value) {
for (MessageCode201PaymentInitiation e : MessageCode201PaymentInitiation.values()) {
if (e.value.equals(value)) {
return e;
}
}
return null;
}
@Override
@JsonValue
public String toString() {
return value;
}
}
| 1,707 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
PeriodicPaymentInitiationXmlPart2StandingorderTypeJson.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/PeriodicPaymentInitiationXmlPart2StandingorderTypeJson.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import javax.annotation.Generated;
import java.time.LocalDate;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class PeriodicPaymentInitiationXmlPart2StandingorderTypeJson {
private LocalDate startDate;
private LocalDate endDate;
private ExecutionRule executionRule;
private FrequencyCode frequency;
private DayOfExecution dayOfExecution;
public LocalDate getStartDate() {
return startDate;
}
public void setStartDate(LocalDate startDate) {
this.startDate = startDate;
}
public LocalDate getEndDate() {
return endDate;
}
public void setEndDate(LocalDate endDate) {
this.endDate = endDate;
}
public ExecutionRule getExecutionRule() {
return executionRule;
}
public void setExecutionRule(ExecutionRule executionRule) {
this.executionRule = executionRule;
}
public FrequencyCode getFrequency() {
return frequency;
}
public void setFrequency(FrequencyCode frequency) {
this.frequency = frequency;
}
public DayOfExecution getDayOfExecution() {
return dayOfExecution;
}
public void setDayOfExecution(DayOfExecution dayOfExecution) {
this.dayOfExecution = dayOfExecution;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PeriodicPaymentInitiationXmlPart2StandingorderTypeJson that = (PeriodicPaymentInitiationXmlPart2StandingorderTypeJson) o;
return Objects.equals(startDate, that.startDate) &&
Objects.equals(endDate, that.endDate) &&
Objects.equals(executionRule, that.executionRule) &&
Objects.equals(frequency, that.frequency) &&
Objects.equals(dayOfExecution, that.dayOfExecution);
}
@Override
public int hashCode() {
return Objects.hash(startDate,
endDate,
executionRule,
frequency,
dayOfExecution);
}
}
| 2,938 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
ConsentStatus.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/ConsentStatus.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import javax.annotation.Generated;
@Generated("xs2a-adapter-codegen")
public enum ConsentStatus {
RECEIVED("received"),
REJECTED("rejected"),
VALID("valid"),
REVOKEDBYPSU("revokedByPsu"),
EXPIRED("expired"),
TERMINATEDBYTPP("terminatedByTpp"),
PARTIALLYAUTHORISED("partiallyAuthorised");
private String value;
ConsentStatus(String value) {
this.value = value;
}
@JsonCreator
public static ConsentStatus fromValue(String value) {
for (ConsentStatus e : ConsentStatus.values()) {
if (e.value.equals(value)) {
return e;
}
}
return null;
}
@Override
@JsonValue
public String toString() {
return value;
}
}
| 1,740 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
Address.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/Address.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import javax.annotation.Generated;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class Address {
private String streetName;
private String buildingNumber;
private String townName;
private String postCode;
private String country;
public String getStreetName() {
return streetName;
}
public void setStreetName(String streetName) {
this.streetName = streetName;
}
public String getBuildingNumber() {
return buildingNumber;
}
public void setBuildingNumber(String buildingNumber) {
this.buildingNumber = buildingNumber;
}
public String getTownName() {
return townName;
}
public void setTownName(String townName) {
this.townName = townName;
}
public String getPostCode() {
return postCode;
}
public void setPostCode(String postCode) {
this.postCode = postCode;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Address that = (Address) o;
return Objects.equals(streetName, that.streetName) &&
Objects.equals(buildingNumber, that.buildingNumber) &&
Objects.equals(townName, that.townName) &&
Objects.equals(postCode, that.postCode) &&
Objects.equals(country, that.country);
}
@Override
public int hashCode() {
return Objects.hash(streetName,
buildingNumber,
townName,
postCode,
country);
}
}
| 2,635 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
TppMessage201PaymentInitiation.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/TppMessage201PaymentInitiation.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import javax.annotation.Generated;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class TppMessage201PaymentInitiation {
private TppMessageCategory category;
private MessageCode201PaymentInitiation code;
private String path;
private String text;
public TppMessageCategory getCategory() {
return category;
}
public void setCategory(TppMessageCategory category) {
this.category = category;
}
public MessageCode201PaymentInitiation getCode() {
return code;
}
public void setCode(MessageCode201PaymentInitiation code) {
this.code = code;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TppMessage201PaymentInitiation that = (TppMessage201PaymentInitiation) o;
return Objects.equals(category, that.category) &&
Objects.equals(code, that.code) &&
Objects.equals(path, that.path) &&
Objects.equals(text, that.text);
}
@Override
public int hashCode() {
return Objects.hash(category,
code,
path,
text);
}
}
| 2,364 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
UpdatePsuIdenticationResponse.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/UpdatePsuIdenticationResponse.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import javax.annotation.Generated;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class UpdatePsuIdenticationResponse {
private Amount transactionFees;
private Amount currencyConversionFees;
private Amount estimatedTotalAmount;
private Amount estimatedInterbankSettlementAmount;
private List<AuthenticationObject> scaMethods;
@JsonProperty("_links")
private Map<String, HrefType> links;
private ScaStatus scaStatus;
private String psuMessage;
public Amount getTransactionFees() {
return transactionFees;
}
public void setTransactionFees(Amount transactionFees) {
this.transactionFees = transactionFees;
}
public Amount getCurrencyConversionFees() {
return currencyConversionFees;
}
public void setCurrencyConversionFees(Amount currencyConversionFees) {
this.currencyConversionFees = currencyConversionFees;
}
public Amount getEstimatedTotalAmount() {
return estimatedTotalAmount;
}
public void setEstimatedTotalAmount(Amount estimatedTotalAmount) {
this.estimatedTotalAmount = estimatedTotalAmount;
}
public Amount getEstimatedInterbankSettlementAmount() {
return estimatedInterbankSettlementAmount;
}
public void setEstimatedInterbankSettlementAmount(Amount estimatedInterbankSettlementAmount) {
this.estimatedInterbankSettlementAmount = estimatedInterbankSettlementAmount;
}
public List<AuthenticationObject> getScaMethods() {
return scaMethods;
}
public void setScaMethods(List<AuthenticationObject> scaMethods) {
this.scaMethods = scaMethods;
}
public Map<String, HrefType> getLinks() {
return links;
}
public void setLinks(Map<String, HrefType> links) {
this.links = links;
}
public ScaStatus getScaStatus() {
return scaStatus;
}
public void setScaStatus(ScaStatus scaStatus) {
this.scaStatus = scaStatus;
}
public String getPsuMessage() {
return psuMessage;
}
public void setPsuMessage(String psuMessage) {
this.psuMessage = psuMessage;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
UpdatePsuIdenticationResponse that = (UpdatePsuIdenticationResponse) o;
return Objects.equals(transactionFees, that.transactionFees) &&
Objects.equals(currencyConversionFees, that.currencyConversionFees) &&
Objects.equals(estimatedTotalAmount, that.estimatedTotalAmount) &&
Objects.equals(estimatedInterbankSettlementAmount, that.estimatedInterbankSettlementAmount) &&
Objects.equals(scaMethods, that.scaMethods) &&
Objects.equals(links, that.links) &&
Objects.equals(scaStatus, that.scaStatus) &&
Objects.equals(psuMessage, that.psuMessage);
}
@Override
public int hashCode() {
return Objects.hash(transactionFees,
currencyConversionFees,
estimatedTotalAmount,
estimatedInterbankSettlementAmount,
scaMethods,
links,
scaStatus,
psuMessage);
}
}
| 4,266 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
Amount.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/Amount.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import javax.annotation.Generated;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class Amount {
private String currency;
private String amount;
public String getCurrency() {
return currency;
}
public void setCurrency(String currency) {
this.currency = currency;
}
public String getAmount() {
return amount;
}
public void setAmount(String amount) {
this.amount = amount;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Amount that = (Amount) o;
return Objects.equals(currency, that.currency) &&
Objects.equals(amount, that.amount);
}
@Override
public int hashCode() {
return Objects.hash(currency,
amount);
}
}
| 1,759 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
ScaStatus.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/ScaStatus.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import javax.annotation.Generated;
@Generated("xs2a-adapter-codegen")
public enum ScaStatus {
RECEIVED("received"),
PSUIDENTIFIED("psuIdentified"),
PSUAUTHENTICATED("psuAuthenticated"),
SCAMETHODSELECTED("scaMethodSelected"),
STARTED("started"),
UNCONFIRMED("unconfirmed"),
FINALISED("finalised"),
FAILED("failed"),
EXEMPTED("exempted");
private String value;
ScaStatus(String value) {
this.value = value;
}
@JsonCreator
public static ScaStatus fromValue(String value) {
for (ScaStatus e : ScaStatus.values()) {
if (e.value.equals(value)) {
return e;
}
}
return null;
}
@Override
@JsonValue
public String toString() {
return value;
}
}
| 1,784 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
SelectPsuAuthenticationMethod.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/SelectPsuAuthenticationMethod.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import javax.annotation.Generated;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class SelectPsuAuthenticationMethod {
private String authenticationMethodId;
public String getAuthenticationMethodId() {
return authenticationMethodId;
}
public void setAuthenticationMethodId(String authenticationMethodId) {
this.authenticationMethodId = authenticationMethodId;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
SelectPsuAuthenticationMethod that = (SelectPsuAuthenticationMethod) o;
return Objects.equals(authenticationMethodId, that.authenticationMethodId);
}
@Override
public int hashCode() {
return Objects.hash(authenticationMethodId);
}
}
| 1,727 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
PaymentInitiationStatusResponse200Json.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/PaymentInitiationStatusResponse200Json.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import javax.annotation.Generated;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class PaymentInitiationStatusResponse200Json {
private TransactionStatus transactionStatus;
private Boolean fundsAvailable;
private String psuMessage;
@JsonProperty("_links")
private Map<String, HrefType> links;
private List<TppMessageInitiationStatusResponse200> tppMessage;
public TransactionStatus getTransactionStatus() {
return transactionStatus;
}
public void setTransactionStatus(TransactionStatus transactionStatus) {
this.transactionStatus = transactionStatus;
}
public Boolean getFundsAvailable() {
return fundsAvailable;
}
public void setFundsAvailable(Boolean fundsAvailable) {
this.fundsAvailable = fundsAvailable;
}
public String getPsuMessage() {
return psuMessage;
}
public void setPsuMessage(String psuMessage) {
this.psuMessage = psuMessage;
}
public Map<String, HrefType> getLinks() {
return links;
}
public void setLinks(Map<String, HrefType> links) {
this.links = links;
}
public List<TppMessageInitiationStatusResponse200> getTppMessage() {
return tppMessage;
}
public void setTppMessage(List<TppMessageInitiationStatusResponse200> tppMessage) {
this.tppMessage = tppMessage;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PaymentInitiationStatusResponse200Json that = (PaymentInitiationStatusResponse200Json) o;
return Objects.equals(transactionStatus, that.transactionStatus) &&
Objects.equals(fundsAvailable, that.fundsAvailable) &&
Objects.equals(psuMessage, that.psuMessage) &&
Objects.equals(links, that.links) &&
Objects.equals(tppMessage, that.tppMessage);
}
@Override
public int hashCode() {
return Objects.hash(transactionStatus,
fundsAvailable,
psuMessage,
links,
tppMessage);
}
}
| 3,138 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
ConsentsResponse201.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/ConsentsResponse201.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import javax.annotation.Generated;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class ConsentsResponse201 {
private ConsentStatus consentStatus;
private String consentId;
private List<AuthenticationObject> scaMethods;
private Object chosenScaMethod;
private ChallengeData challengeData;
@JsonProperty("_links")
private Map<String, HrefType> links;
private String psuMessage;
private List<TppMessageGeneric> tppMessages;
private ScaStatus scaStatus;
public ConsentStatus getConsentStatus() {
return consentStatus;
}
public void setConsentStatus(ConsentStatus consentStatus) {
this.consentStatus = consentStatus;
}
public String getConsentId() {
return consentId;
}
public void setConsentId(String consentId) {
this.consentId = consentId;
}
public List<AuthenticationObject> getScaMethods() {
return scaMethods;
}
public void setScaMethods(List<AuthenticationObject> scaMethods) {
this.scaMethods = scaMethods;
}
public Object getChosenScaMethod() {
return chosenScaMethod;
}
public void setChosenScaMethod(Object chosenScaMethod) {
this.chosenScaMethod = chosenScaMethod;
}
public ChallengeData getChallengeData() {
return challengeData;
}
public void setChallengeData(ChallengeData challengeData) {
this.challengeData = challengeData;
}
public Map<String, HrefType> getLinks() {
return links;
}
public void setLinks(Map<String, HrefType> links) {
this.links = links;
}
public String getPsuMessage() {
return psuMessage;
}
public void setPsuMessage(String psuMessage) {
this.psuMessage = psuMessage;
}
public List<TppMessageGeneric> getTppMessages() {
return tppMessages;
}
public void setTppMessages(List<TppMessageGeneric> tppMessages) {
this.tppMessages = tppMessages;
}
public ScaStatus getScaStatus() {
return scaStatus;
}
public void setScaStatus(ScaStatus scaStatus) {
this.scaStatus = scaStatus;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ConsentsResponse201 that = (ConsentsResponse201) o;
return Objects.equals(consentStatus, that.consentStatus) &&
Objects.equals(consentId, that.consentId) &&
Objects.equals(scaMethods, that.scaMethods) &&
Objects.equals(chosenScaMethod, that.chosenScaMethod) &&
Objects.equals(challengeData, that.challengeData) &&
Objects.equals(links, that.links) &&
Objects.equals(psuMessage, that.psuMessage) &&
Objects.equals(tppMessages, that.tppMessages) &&
Objects.equals(scaStatus, that.scaStatus);
}
@Override
public int hashCode() {
return Objects.hash(consentStatus,
consentId,
scaMethods,
chosenScaMethod,
challengeData,
links,
psuMessage,
tppMessages,
scaStatus);
}
}
| 4,210 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
OK200TransactionDetails.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/OK200TransactionDetails.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import javax.annotation.Generated;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class OK200TransactionDetails {
private Transactions transactionsDetails;
public Transactions getTransactionsDetails() {
return transactionsDetails;
}
public void setTransactionsDetails(Transactions transactionsDetails) {
this.transactionsDetails = transactionsDetails;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
OK200TransactionDetails that = (OK200TransactionDetails) o;
return Objects.equals(transactionsDetails, that.transactionsDetails);
}
@Override
public int hashCode() {
return Objects.hash(transactionsDetails);
}
}
| 1,697 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
StandingOrderDetails.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/StandingOrderDetails.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import javax.annotation.Generated;
import java.time.LocalDate;
import java.util.List;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class StandingOrderDetails {
private LocalDate startDate;
private FrequencyCode frequency;
private LocalDate endDate;
private ExecutionRule executionRule;
private Boolean withinAMonthFlag;
private List<MonthsOfExecution> monthsOfExecution;
private Integer multiplicator;
private DayOfExecution dayOfExecution;
private Amount limitAmount;
public LocalDate getStartDate() {
return startDate;
}
public void setStartDate(LocalDate startDate) {
this.startDate = startDate;
}
public FrequencyCode getFrequency() {
return frequency;
}
public void setFrequency(FrequencyCode frequency) {
this.frequency = frequency;
}
public LocalDate getEndDate() {
return endDate;
}
public void setEndDate(LocalDate endDate) {
this.endDate = endDate;
}
public ExecutionRule getExecutionRule() {
return executionRule;
}
public void setExecutionRule(ExecutionRule executionRule) {
this.executionRule = executionRule;
}
public Boolean getWithinAMonthFlag() {
return withinAMonthFlag;
}
public void setWithinAMonthFlag(Boolean withinAMonthFlag) {
this.withinAMonthFlag = withinAMonthFlag;
}
public List<MonthsOfExecution> getMonthsOfExecution() {
return monthsOfExecution;
}
public void setMonthsOfExecution(List<MonthsOfExecution> monthsOfExecution) {
this.monthsOfExecution = monthsOfExecution;
}
public Integer getMultiplicator() {
return multiplicator;
}
public void setMultiplicator(Integer multiplicator) {
this.multiplicator = multiplicator;
}
public DayOfExecution getDayOfExecution() {
return dayOfExecution;
}
public void setDayOfExecution(DayOfExecution dayOfExecution) {
this.dayOfExecution = dayOfExecution;
}
public Amount getLimitAmount() {
return limitAmount;
}
public void setLimitAmount(Amount limitAmount) {
this.limitAmount = limitAmount;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
StandingOrderDetails that = (StandingOrderDetails) o;
return Objects.equals(startDate, that.startDate) &&
Objects.equals(frequency, that.frequency) &&
Objects.equals(endDate, that.endDate) &&
Objects.equals(executionRule, that.executionRule) &&
Objects.equals(withinAMonthFlag, that.withinAMonthFlag) &&
Objects.equals(monthsOfExecution, that.monthsOfExecution) &&
Objects.equals(multiplicator, that.multiplicator) &&
Objects.equals(dayOfExecution, that.dayOfExecution) &&
Objects.equals(limitAmount, that.limitAmount);
}
@Override
public int hashCode() {
return Objects.hash(startDate,
frequency,
endDate,
executionRule,
withinAMonthFlag,
monthsOfExecution,
multiplicator,
dayOfExecution,
limitAmount);
}
public enum MonthsOfExecution {
_1("1"),
_2("2"),
_3("3"),
_4("4"),
_5("5"),
_6("6"),
_7("7"),
_8("8"),
_9("9"),
_10("10"),
_11("11"),
_12("12");
private String value;
MonthsOfExecution(String value) {
this.value = value;
}
@JsonCreator
public static MonthsOfExecution fromValue(String value) {
for (MonthsOfExecution e : MonthsOfExecution.values()) {
if (e.value.equals(value)) {
return e;
}
}
return null;
}
@Override
@JsonValue
public String toString() {
return value;
}
}
}
| 5,103 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
HrefType.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/HrefType.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import javax.annotation.Generated;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class HrefType {
private String href;
public String getHref() {
return href;
}
public void setHref(String href) {
this.href = href;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
HrefType that = (HrefType) o;
return Objects.equals(href, that.href);
}
@Override
public int hashCode() {
return Objects.hash(href);
}
}
| 1,484 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
TransactionsResponse200Json.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/TransactionsResponse200Json.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import javax.annotation.Generated;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class TransactionsResponse200Json {
private AccountReference account;
private AccountReport transactions;
private List<Balance> balances;
@JsonProperty("_links")
private Map<String, HrefType> links;
public AccountReference getAccount() {
return account;
}
public void setAccount(AccountReference account) {
this.account = account;
}
public AccountReport getTransactions() {
return transactions;
}
public void setTransactions(AccountReport transactions) {
this.transactions = transactions;
}
public List<Balance> getBalances() {
return balances;
}
public void setBalances(List<Balance> balances) {
this.balances = balances;
}
public Map<String, HrefType> getLinks() {
return links;
}
public void setLinks(Map<String, HrefType> links) {
this.links = links;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TransactionsResponse200Json that = (TransactionsResponse200Json) o;
return Objects.equals(account, that.account) &&
Objects.equals(transactions, that.transactions) &&
Objects.equals(balances, that.balances) &&
Objects.equals(links, that.links);
}
@Override
public int hashCode() {
return Objects.hash(account,
transactions,
balances,
links);
}
}
| 2,609 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
BookingStatusCard.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/BookingStatusCard.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import javax.annotation.Generated;
@Generated("xs2a-adapter-codegen")
public enum BookingStatusCard {
BOOKED("booked"),
PENDING("pending"),
BOTH("both");
private String value;
BookingStatusCard(String value) {
this.value = value;
}
@JsonCreator
public static BookingStatusCard fromValue(String value) {
for (BookingStatusCard e : BookingStatusCard.values()) {
if (e.value.equals(value)) {
return e;
}
}
return null;
}
@Override
@JsonValue
public String toString() {
return value;
}
}
| 1,602 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
CardAccountReport.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/CardAccountReport.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import javax.annotation.Generated;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class CardAccountReport {
private List<CardTransaction> booked;
private List<CardTransaction> pending;
@JsonProperty("_links")
private Map<String, HrefType> links;
public List<CardTransaction> getBooked() {
return booked;
}
public void setBooked(List<CardTransaction> booked) {
this.booked = booked;
}
public List<CardTransaction> getPending() {
return pending;
}
public void setPending(List<CardTransaction> pending) {
this.pending = pending;
}
public Map<String, HrefType> getLinks() {
return links;
}
public void setLinks(Map<String, HrefType> links) {
this.links = links;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
CardAccountReport that = (CardAccountReport) o;
return Objects.equals(booked, that.booked) &&
Objects.equals(pending, that.pending) &&
Objects.equals(links, that.links);
}
@Override
public int hashCode() {
return Objects.hash(booked,
pending,
links);
}
}
| 2,276 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
BookingStatusGeneric.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/BookingStatusGeneric.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import javax.annotation.Generated;
@Generated("xs2a-adapter-codegen")
public enum BookingStatusGeneric {
INFORMATION("information"),
BOOKED("booked"),
PENDING("pending"),
BOTH("both"),
ALL("all");
private String value;
BookingStatusGeneric(String value) {
this.value = value;
}
@JsonCreator
public static BookingStatusGeneric fromValue(String value) {
for (BookingStatusGeneric e : BookingStatusGeneric.values()) {
if (e.value.equals(value)) {
return e;
}
}
return null;
}
@Override
@JsonValue
public String toString() {
return value;
}
}
| 1,667 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
ReadCardAccountBalanceResponse200.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/ReadCardAccountBalanceResponse200.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import javax.annotation.Generated;
import java.util.List;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class ReadCardAccountBalanceResponse200 {
private AccountReference cardAccount;
private Boolean debitAccounting;
private List<Balance> balances;
public AccountReference getCardAccount() {
return cardAccount;
}
public void setCardAccount(AccountReference cardAccount) {
this.cardAccount = cardAccount;
}
public Boolean getDebitAccounting() {
return debitAccounting;
}
public void setDebitAccounting(Boolean debitAccounting) {
this.debitAccounting = debitAccounting;
}
public List<Balance> getBalances() {
return balances;
}
public void setBalances(List<Balance> balances) {
this.balances = balances;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ReadCardAccountBalanceResponse200 that = (ReadCardAccountBalanceResponse200) o;
return Objects.equals(cardAccount, that.cardAccount) &&
Objects.equals(debitAccounting, that.debitAccounting) &&
Objects.equals(balances, that.balances);
}
@Override
public int hashCode() {
return Objects.hash(cardAccount,
debitAccounting,
balances);
}
}
| 2,298 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
PaymentInitationRequestResponse201.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/PaymentInitationRequestResponse201.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import javax.annotation.Generated;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class PaymentInitationRequestResponse201 {
private TransactionStatus transactionStatus;
private String paymentId;
private Amount transactionFees;
private Amount currencyConversionFee;
private Amount estimatedTotalAmount;
private Amount estimatedInterbankSettlementAmount;
private Boolean transactionFeeIndicator;
private List<AuthenticationObject> scaMethods;
private Object chosenScaMethod;
private ChallengeData challengeData;
@JsonProperty("_links")
private Map<String, HrefType> links;
private String psuMessage;
private List<TppMessage201PaymentInitiation> tppMessages;
private ScaStatus scaStatus;
public TransactionStatus getTransactionStatus() {
return transactionStatus;
}
public void setTransactionStatus(TransactionStatus transactionStatus) {
this.transactionStatus = transactionStatus;
}
public String getPaymentId() {
return paymentId;
}
public void setPaymentId(String paymentId) {
this.paymentId = paymentId;
}
public Amount getTransactionFees() {
return transactionFees;
}
public void setTransactionFees(Amount transactionFees) {
this.transactionFees = transactionFees;
}
public Amount getCurrencyConversionFee() {
return currencyConversionFee;
}
public void setCurrencyConversionFee(Amount currencyConversionFee) {
this.currencyConversionFee = currencyConversionFee;
}
public Amount getEstimatedTotalAmount() {
return estimatedTotalAmount;
}
public void setEstimatedTotalAmount(Amount estimatedTotalAmount) {
this.estimatedTotalAmount = estimatedTotalAmount;
}
public Amount getEstimatedInterbankSettlementAmount() {
return estimatedInterbankSettlementAmount;
}
public void setEstimatedInterbankSettlementAmount(Amount estimatedInterbankSettlementAmount) {
this.estimatedInterbankSettlementAmount = estimatedInterbankSettlementAmount;
}
public Boolean getTransactionFeeIndicator() {
return transactionFeeIndicator;
}
public void setTransactionFeeIndicator(Boolean transactionFeeIndicator) {
this.transactionFeeIndicator = transactionFeeIndicator;
}
public List<AuthenticationObject> getScaMethods() {
return scaMethods;
}
public void setScaMethods(List<AuthenticationObject> scaMethods) {
this.scaMethods = scaMethods;
}
public Object getChosenScaMethod() {
return chosenScaMethod;
}
public void setChosenScaMethod(Object chosenScaMethod) {
this.chosenScaMethod = chosenScaMethod;
}
public ChallengeData getChallengeData() {
return challengeData;
}
public void setChallengeData(ChallengeData challengeData) {
this.challengeData = challengeData;
}
public Map<String, HrefType> getLinks() {
return links;
}
public void setLinks(Map<String, HrefType> links) {
this.links = links;
}
public String getPsuMessage() {
return psuMessage;
}
public void setPsuMessage(String psuMessage) {
this.psuMessage = psuMessage;
}
public List<TppMessage201PaymentInitiation> getTppMessages() {
return tppMessages;
}
public void setTppMessages(List<TppMessage201PaymentInitiation> tppMessages) {
this.tppMessages = tppMessages;
}
public ScaStatus getScaStatus() {
return scaStatus;
}
public void setScaStatus(ScaStatus scaStatus) {
this.scaStatus = scaStatus;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PaymentInitationRequestResponse201 that = (PaymentInitationRequestResponse201) o;
return Objects.equals(transactionStatus, that.transactionStatus) &&
Objects.equals(paymentId, that.paymentId) &&
Objects.equals(transactionFees, that.transactionFees) &&
Objects.equals(currencyConversionFee, that.currencyConversionFee) &&
Objects.equals(estimatedTotalAmount, that.estimatedTotalAmount) &&
Objects.equals(estimatedInterbankSettlementAmount, that.estimatedInterbankSettlementAmount) &&
Objects.equals(transactionFeeIndicator, that.transactionFeeIndicator) &&
Objects.equals(scaMethods, that.scaMethods) &&
Objects.equals(chosenScaMethod, that.chosenScaMethod) &&
Objects.equals(challengeData, that.challengeData) &&
Objects.equals(links, that.links) &&
Objects.equals(psuMessage, that.psuMessage) &&
Objects.equals(tppMessages, that.tppMessages) &&
Objects.equals(scaStatus, that.scaStatus);
}
@Override
public int hashCode() {
return Objects.hash(transactionStatus,
paymentId,
transactionFees,
currencyConversionFee,
estimatedTotalAmount,
estimatedInterbankSettlementAmount,
transactionFeeIndicator,
scaMethods,
chosenScaMethod,
challengeData,
links,
psuMessage,
tppMessages,
scaStatus);
}
}
| 6,384 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
BalanceType.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/BalanceType.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import javax.annotation.Generated;
@Generated("xs2a-adapter-codegen")
public enum BalanceType {
CLOSINGBOOKED("closingBooked"),
EXPECTED("expected"),
OPENINGBOOKED("openingBooked"),
INTERIMAVAILABLE("interimAvailable"),
INTERIMBOOKED("interimBooked"),
FORWARDAVAILABLE("forwardAvailable"),
NONINVOICED("nonInvoiced");
private String value;
BalanceType(String value) {
this.value = value;
}
@JsonCreator
public static BalanceType fromValue(String value) {
for (BalanceType e : BalanceType.values()) {
if (e.value.equals(value)) {
return e;
}
}
return null;
}
@Override
@JsonValue
public String toString() {
return value;
}
}
| 1,762 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
AccountDetails.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/AccountDetails.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import javax.annotation.Generated;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class AccountDetails {
private String resourceId;
private String iban;
private String bban;
private String msisdn;
private String currency;
private String name;
private String displayName;
private String product;
private String cashAccountType;
private AccountStatus status;
private String bic;
private String linkedAccounts;
private Usage usage;
private String details;
private List<Balance> balances;
@JsonProperty("_links")
private Map<String, HrefType> links;
private String ownerName;
public String getResourceId() {
return resourceId;
}
public void setResourceId(String resourceId) {
this.resourceId = resourceId;
}
public String getIban() {
return iban;
}
public void setIban(String iban) {
this.iban = iban;
}
public String getBban() {
return bban;
}
public void setBban(String bban) {
this.bban = bban;
}
public String getMsisdn() {
return msisdn;
}
public void setMsisdn(String msisdn) {
this.msisdn = msisdn;
}
public String getCurrency() {
return currency;
}
public void setCurrency(String currency) {
this.currency = currency;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public String getProduct() {
return product;
}
public void setProduct(String product) {
this.product = product;
}
public String getCashAccountType() {
return cashAccountType;
}
public void setCashAccountType(String cashAccountType) {
this.cashAccountType = cashAccountType;
}
public AccountStatus getStatus() {
return status;
}
public void setStatus(AccountStatus status) {
this.status = status;
}
public String getBic() {
return bic;
}
public void setBic(String bic) {
this.bic = bic;
}
public String getLinkedAccounts() {
return linkedAccounts;
}
public void setLinkedAccounts(String linkedAccounts) {
this.linkedAccounts = linkedAccounts;
}
public Usage getUsage() {
return usage;
}
public void setUsage(Usage usage) {
this.usage = usage;
}
public String getDetails() {
return details;
}
public void setDetails(String details) {
this.details = details;
}
public List<Balance> getBalances() {
return balances;
}
public void setBalances(List<Balance> balances) {
this.balances = balances;
}
public Map<String, HrefType> getLinks() {
return links;
}
public void setLinks(Map<String, HrefType> links) {
this.links = links;
}
public String getOwnerName() {
return ownerName;
}
public void setOwnerName(String ownerName) {
this.ownerName = ownerName;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AccountDetails that = (AccountDetails) o;
return Objects.equals(resourceId, that.resourceId) &&
Objects.equals(iban, that.iban) &&
Objects.equals(bban, that.bban) &&
Objects.equals(msisdn, that.msisdn) &&
Objects.equals(currency, that.currency) &&
Objects.equals(name, that.name) &&
Objects.equals(displayName, that.displayName) &&
Objects.equals(product, that.product) &&
Objects.equals(cashAccountType, that.cashAccountType) &&
Objects.equals(status, that.status) &&
Objects.equals(bic, that.bic) &&
Objects.equals(linkedAccounts, that.linkedAccounts) &&
Objects.equals(usage, that.usage) &&
Objects.equals(details, that.details) &&
Objects.equals(balances, that.balances) &&
Objects.equals(links, that.links) &&
Objects.equals(ownerName, that.ownerName);
}
@Override
public int hashCode() {
return Objects.hash(resourceId,
iban,
bban,
msisdn,
currency,
name,
displayName,
product,
cashAccountType,
status,
bic,
linkedAccounts,
usage,
details,
balances,
links,
ownerName);
}
public enum Usage {
PRIV("PRIV"),
ORGA("ORGA");
private String value;
Usage(String value) {
this.value = value;
}
@JsonCreator
public static Usage fromValue(String value) {
for (Usage e : Usage.values()) {
if (e.value.equals(value)) {
return e;
}
}
return null;
}
@Override
@JsonValue
public String toString() {
return value;
}
}
}
| 6,486 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
TransactionAuthorisation.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/TransactionAuthorisation.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import javax.annotation.Generated;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class TransactionAuthorisation {
private String scaAuthenticationData;
public String getScaAuthenticationData() {
return scaAuthenticationData;
}
public void setScaAuthenticationData(String scaAuthenticationData) {
this.scaAuthenticationData = scaAuthenticationData;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
TransactionAuthorisation that = (TransactionAuthorisation) o;
return Objects.equals(scaAuthenticationData, that.scaAuthenticationData);
}
@Override
public int hashCode() {
return Objects.hash(scaAuthenticationData);
}
}
| 1,702 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
BulkPaymentInitiationJson.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/BulkPaymentInitiationJson.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import javax.annotation.Generated;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class BulkPaymentInitiationJson {
private Boolean batchBookingPreferred;
private AccountReference debtorAccount;
private LocalDate requestedExecutionDate;
private OffsetDateTime requestedExecutionTime;
private List<PaymentInitiationBulkElementJson> payments;
private String debtorName;
public Boolean getBatchBookingPreferred() {
return batchBookingPreferred;
}
public void setBatchBookingPreferred(Boolean batchBookingPreferred) {
this.batchBookingPreferred = batchBookingPreferred;
}
public AccountReference getDebtorAccount() {
return debtorAccount;
}
public void setDebtorAccount(AccountReference debtorAccount) {
this.debtorAccount = debtorAccount;
}
public LocalDate getRequestedExecutionDate() {
return requestedExecutionDate;
}
public void setRequestedExecutionDate(LocalDate requestedExecutionDate) {
this.requestedExecutionDate = requestedExecutionDate;
}
public OffsetDateTime getRequestedExecutionTime() {
return requestedExecutionTime;
}
public void setRequestedExecutionTime(OffsetDateTime requestedExecutionTime) {
this.requestedExecutionTime = requestedExecutionTime;
}
public List<PaymentInitiationBulkElementJson> getPayments() {
return payments;
}
public void setPayments(List<PaymentInitiationBulkElementJson> payments) {
this.payments = payments;
}
public String getDebtorName() {
return debtorName;
}
public void setDebtorName(String debtorName) {
this.debtorName = debtorName;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
BulkPaymentInitiationJson that = (BulkPaymentInitiationJson) o;
return Objects.equals(batchBookingPreferred, that.batchBookingPreferred) &&
Objects.equals(debtorAccount, that.debtorAccount) &&
Objects.equals(requestedExecutionDate, that.requestedExecutionDate) &&
Objects.equals(requestedExecutionTime, that.requestedExecutionTime) &&
Objects.equals(payments, that.payments) &&
Objects.equals(debtorName, that.debtorName);
}
@Override
public int hashCode() {
return Objects.hash(batchBookingPreferred,
debtorAccount,
requestedExecutionDate,
requestedExecutionTime,
payments,
debtorName);
}
}
| 3,606 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
FrequencyCode.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/FrequencyCode.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import javax.annotation.Generated;
@Generated("xs2a-adapter-codegen")
public enum FrequencyCode {
DAILY("Daily"),
WEEKLY("Weekly"),
EVERYTWOWEEKS("EveryTwoWeeks"),
MONTHLY("Monthly"),
EVERYTWOMONTHS("EveryTwoMonths"),
QUARTERLY("Quarterly"),
SEMIANNUAL("SemiAnnual"),
ANNUAL("Annual"),
MONTHLYVARIABLE("MonthlyVariable");
private String value;
FrequencyCode(String value) {
this.value = value;
}
@JsonCreator
public static FrequencyCode fromValue(String value) {
for (FrequencyCode e : FrequencyCode.values()) {
if (e.value.equals(value)) {
return e;
}
}
return null;
}
@Override
@JsonValue
public String toString() {
return value;
}
}
| 1,784 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
CardAccountDetails.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/CardAccountDetails.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import javax.annotation.Generated;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class CardAccountDetails {
private String resourceId;
private String maskedPan;
private String currency;
private String ownerName;
private String name;
private String displayName;
private String product;
private Boolean debitAccounting;
private AccountStatus status;
private Usage usage;
private String details;
private Amount creditLimit;
private List<Balance> balances;
@JsonProperty("_links")
private Map<String, HrefType> links;
public String getResourceId() {
return resourceId;
}
public void setResourceId(String resourceId) {
this.resourceId = resourceId;
}
public String getMaskedPan() {
return maskedPan;
}
public void setMaskedPan(String maskedPan) {
this.maskedPan = maskedPan;
}
public String getCurrency() {
return currency;
}
public void setCurrency(String currency) {
this.currency = currency;
}
public String getOwnerName() {
return ownerName;
}
public void setOwnerName(String ownerName) {
this.ownerName = ownerName;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public String getProduct() {
return product;
}
public void setProduct(String product) {
this.product = product;
}
public Boolean getDebitAccounting() {
return debitAccounting;
}
public void setDebitAccounting(Boolean debitAccounting) {
this.debitAccounting = debitAccounting;
}
public AccountStatus getStatus() {
return status;
}
public void setStatus(AccountStatus status) {
this.status = status;
}
public Usage getUsage() {
return usage;
}
public void setUsage(Usage usage) {
this.usage = usage;
}
public String getDetails() {
return details;
}
public void setDetails(String details) {
this.details = details;
}
public Amount getCreditLimit() {
return creditLimit;
}
public void setCreditLimit(Amount creditLimit) {
this.creditLimit = creditLimit;
}
public List<Balance> getBalances() {
return balances;
}
public void setBalances(List<Balance> balances) {
this.balances = balances;
}
public Map<String, HrefType> getLinks() {
return links;
}
public void setLinks(Map<String, HrefType> links) {
this.links = links;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
CardAccountDetails that = (CardAccountDetails) o;
return Objects.equals(resourceId, that.resourceId) &&
Objects.equals(maskedPan, that.maskedPan) &&
Objects.equals(currency, that.currency) &&
Objects.equals(ownerName, that.ownerName) &&
Objects.equals(name, that.name) &&
Objects.equals(displayName, that.displayName) &&
Objects.equals(product, that.product) &&
Objects.equals(debitAccounting, that.debitAccounting) &&
Objects.equals(status, that.status) &&
Objects.equals(usage, that.usage) &&
Objects.equals(details, that.details) &&
Objects.equals(creditLimit, that.creditLimit) &&
Objects.equals(balances, that.balances) &&
Objects.equals(links, that.links);
}
@Override
public int hashCode() {
return Objects.hash(resourceId,
maskedPan,
currency,
ownerName,
name,
displayName,
product,
debitAccounting,
status,
usage,
details,
creditLimit,
balances,
links);
}
public enum Usage {
PRIV("PRIV"),
ORGA("ORGA");
private String value;
Usage(String value) {
this.value = value;
}
@JsonCreator
public static Usage fromValue(String value) {
for (Usage e : Usage.values()) {
if (e.value.equals(value)) {
return e;
}
}
return null;
}
@Override
@JsonValue
public String toString() {
return value;
}
}
}
| 5,848 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
TppMessageCategory.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/TppMessageCategory.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import javax.annotation.Generated;
@Generated("xs2a-adapter-codegen")
public enum TppMessageCategory {
ERROR("ERROR"),
WARNING("WARNING");
private String value;
TppMessageCategory(String value) {
this.value = value;
}
@JsonCreator
public static TppMessageCategory fromValue(String value) {
for (TppMessageCategory e : TppMessageCategory.values()) {
if (e.value.equals(value)) {
return e;
}
}
return null;
}
@Override
@JsonValue
public String toString() {
return value;
}
}
| 1,586 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
UpdatePsuAuthentication.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/UpdatePsuAuthentication.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import javax.annotation.Generated;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class UpdatePsuAuthentication {
private PsuData psuData;
public PsuData getPsuData() {
return psuData;
}
public void setPsuData(PsuData psuData) {
this.psuData = psuData;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
UpdatePsuAuthentication that = (UpdatePsuAuthentication) o;
return Objects.equals(psuData, that.psuData);
}
@Override
public int hashCode() {
return Objects.hash(psuData);
}
}
| 1,562 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
PaymentService.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/PaymentService.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import javax.annotation.Generated;
@Generated("xs2a-adapter-codegen")
public enum PaymentService {
PAYMENTS("payments"),
BULK_PAYMENTS("bulk-payments"),
PERIODIC_PAYMENTS("periodic-payments");
private String value;
PaymentService(String value) {
this.value = value;
}
@JsonCreator
public static PaymentService fromValue(String value) {
for (PaymentService e : PaymentService.values()) {
if (e.value.equals(value)) {
return e;
}
}
return null;
}
@Override
@JsonValue
public String toString() {
return value;
}
}
| 1,629 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
ConsentInformationResponse200Json.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/ConsentInformationResponse200Json.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import javax.annotation.Generated;
import java.time.LocalDate;
import java.util.Map;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class ConsentInformationResponse200Json {
private AccountAccess access;
private Boolean recurringIndicator;
private LocalDate validUntil;
private Integer frequencyPerDay;
private LocalDate lastActionDate;
private ConsentStatus consentStatus;
@JsonProperty("_links")
private Map<String, HrefType> links;
public AccountAccess getAccess() {
return access;
}
public void setAccess(AccountAccess access) {
this.access = access;
}
public Boolean getRecurringIndicator() {
return recurringIndicator;
}
public void setRecurringIndicator(Boolean recurringIndicator) {
this.recurringIndicator = recurringIndicator;
}
public LocalDate getValidUntil() {
return validUntil;
}
public void setValidUntil(LocalDate validUntil) {
this.validUntil = validUntil;
}
public Integer getFrequencyPerDay() {
return frequencyPerDay;
}
public void setFrequencyPerDay(Integer frequencyPerDay) {
this.frequencyPerDay = frequencyPerDay;
}
public LocalDate getLastActionDate() {
return lastActionDate;
}
public void setLastActionDate(LocalDate lastActionDate) {
this.lastActionDate = lastActionDate;
}
public ConsentStatus getConsentStatus() {
return consentStatus;
}
public void setConsentStatus(ConsentStatus consentStatus) {
this.consentStatus = consentStatus;
}
public Map<String, HrefType> getLinks() {
return links;
}
public void setLinks(Map<String, HrefType> links) {
this.links = links;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ConsentInformationResponse200Json that = (ConsentInformationResponse200Json) o;
return Objects.equals(access, that.access) &&
Objects.equals(recurringIndicator, that.recurringIndicator) &&
Objects.equals(validUntil, that.validUntil) &&
Objects.equals(frequencyPerDay, that.frequencyPerDay) &&
Objects.equals(lastActionDate, that.lastActionDate) &&
Objects.equals(consentStatus, that.consentStatus) &&
Objects.equals(links, that.links);
}
@Override
public int hashCode() {
return Objects.hash(access,
recurringIndicator,
validUntil,
frequencyPerDay,
lastActionDate,
consentStatus,
links);
}
}
| 3,659 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
AdditionalInformationStructured.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/AdditionalInformationStructured.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import javax.annotation.Generated;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class AdditionalInformationStructured {
private StandingOrderDetails standingOrderDetails;
public StandingOrderDetails getStandingOrderDetails() {
return standingOrderDetails;
}
public void setStandingOrderDetails(StandingOrderDetails standingOrderDetails) {
this.standingOrderDetails = standingOrderDetails;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AdditionalInformationStructured that = (AdditionalInformationStructured) o;
return Objects.equals(standingOrderDetails, that.standingOrderDetails);
}
@Override
public int hashCode() {
return Objects.hash(standingOrderDetails);
}
}
| 1,755 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
AdditionalInformationAccess.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-generated-api/src/main/java/de/adorsys/xs2a/adapter/api/model/AdditionalInformationAccess.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.api.model;
import javax.annotation.Generated;
import java.util.List;
import java.util.Objects;
@Generated("xs2a-adapter-codegen")
public class AdditionalInformationAccess {
private List<AccountReference> ownerName;
private List<AccountReference> trustedBeneficiaries;
public List<AccountReference> getOwnerName() {
return ownerName;
}
public void setOwnerName(List<AccountReference> ownerName) {
this.ownerName = ownerName;
}
public List<AccountReference> getTrustedBeneficiaries() {
return trustedBeneficiaries;
}
public void setTrustedBeneficiaries(List<AccountReference> trustedBeneficiaries) {
this.trustedBeneficiaries = trustedBeneficiaries;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AdditionalInformationAccess that = (AdditionalInformationAccess) o;
return Objects.equals(ownerName, that.ownerName) &&
Objects.equals(trustedBeneficiaries, that.trustedBeneficiaries);
}
@Override
public int hashCode() {
return Objects.hash(ownerName,
trustedBeneficiaries);
}
}
| 2,091 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
CertificateSubjectClientIdOauth2ServiceTest.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/test/java/de/adorsys/xs2a/adapter/impl/CertificateSubjectClientIdOauth2ServiceTest.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl;
import de.adorsys.xs2a.adapter.api.Oauth2Service;
import de.adorsys.xs2a.adapter.api.Oauth2Service.Parameters;
import de.adorsys.xs2a.adapter.api.Pkcs12KeyStore;
import de.adorsys.xs2a.adapter.api.model.TokenResponse;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import java.io.IOException;
import java.net.URI;
import java.security.KeyStoreException;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.*;
class CertificateSubjectClientIdOauth2ServiceTest {
private static final String organisationIdentifier = "organisationIdentifier";
private Pkcs12KeyStore pkcs12KeyStore = mock(Pkcs12KeyStore.class);
private Oauth2Service oauth2Service = mock(Oauth2Service.class);
private CertificateSubjectClientIdOauth2Service service = new CertificateSubjectClientIdOauth2Service(oauth2Service, pkcs12KeyStore);
private ArgumentCaptor<Parameters> captor = ArgumentCaptor.forClass(Parameters.class);
private Parameters parameters = new Parameters();
@Test
void getAuthorizationRequestUri() throws IOException, KeyStoreException {
String authorisationRequestUri = "https://authorisation.endpoint?" +
"response_type=code&state=state&redirect_uri=https%3A%2F%2Fredirect";
URI expectedOutput = URI.create(authorisationRequestUri + "&" + Parameters.CLIENT_ID + "=" + organisationIdentifier);
when(oauth2Service.getAuthorizationRequestUri(any(), any())).thenReturn(URI.create(authorisationRequestUri));
when(pkcs12KeyStore.getOrganizationIdentifier()).thenReturn(organisationIdentifier);
URI actual = service.getAuthorizationRequestUri(null, parameters);
verify(oauth2Service, times(1)).getAuthorizationRequestUri(any(), any());
verify(pkcs12KeyStore, times(1)).getOrganizationIdentifier();
assertEquals(actual, expectedOutput);
}
@Test
void getAuthorizationRequestUri_throwingException() throws IOException, KeyStoreException {
when(oauth2Service.getAuthorizationRequestUri(any(), any())).thenReturn(URI.create(""));
when(pkcs12KeyStore.getOrganizationIdentifier()).thenThrow(KeyStoreException.class);
assertThrows(RuntimeException.class, () -> service.getAuthorizationRequestUri(null, parameters));
}
@Test
void getToken() throws KeyStoreException, IOException {
when(pkcs12KeyStore.getOrganizationIdentifier()).thenReturn(organisationIdentifier);
when(oauth2Service.getToken(any(), eq(parameters))).thenReturn(new TokenResponse());
service.getToken(null, parameters);
verify(pkcs12KeyStore, times(1)).getOrganizationIdentifier();
verify(oauth2Service, times(1)).getToken(any(), captor.capture());
assertEquals(organisationIdentifier, captor.getValue().getClientId());
}
}
| 3,833 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
BasePaymentInitiationServiceTest.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/test/java/de/adorsys/xs2a/adapter/impl/BasePaymentInitiationServiceTest.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl;
import de.adorsys.xs2a.adapter.api.RequestHeaders;
import de.adorsys.xs2a.adapter.api.RequestParams;
import de.adorsys.xs2a.adapter.api.Response;
import de.adorsys.xs2a.adapter.api.http.HttpClient;
import de.adorsys.xs2a.adapter.api.http.Interceptor;
import de.adorsys.xs2a.adapter.api.http.Request;
import de.adorsys.xs2a.adapter.api.model.*;
import de.adorsys.xs2a.adapter.impl.http.RequestBuilderImpl;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.*;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.*;
class BasePaymentInitiationServiceTest {
private static final PaymentService PAYMENT_SERVICE = PaymentService.PAYMENTS;
public static final PaymentProduct SEPA_CREDIT_TRANSFERS = PaymentProduct.SEPA_CREDIT_TRANSFERS;
public static final PaymentProduct PAIN_SEPA_CREDIT_TRANSFERS = PaymentProduct.PAIN_001_SEPA_CREDIT_TRANSFERS;
public static final String BASE_URI = "https://base.uri";
private static final String IDP_URL = "https://idp.url";
public static final String PAYMENTS_URI = BASE_URI + "/v1/payments";
public static final String PAYMENTID = "paymentId";
public static final String AUTHORISATIONID = "authorisationId";
public static final String UPDATE_PAYMENT_PSU_DATA_URI = BASE_URI + "/v1/" + PAYMENT_SERVICE + "/" +
SEPA_CREDIT_TRANSFERS + "/" + PAYMENTID + "/authorisations/" + AUTHORISATIONID;
private static final Aspsp ASPSP = buildAspspWithUrls();
private RequestHeaders headers = RequestHeaders.fromMap(new HashMap<>());
@Mock
private HttpClient httpClient;
@Mock
private Interceptor interceptor;
@Spy
private Request.Builder requestBuilder = new RequestBuilderImpl(httpClient, null, null);
@Captor
private ArgumentCaptor<String> uriCaptor, bodyCaptor;
@Captor
private ArgumentCaptor<Map<String, String>> headersCaptor;
private BasePaymentInitiationService initiationService;
@BeforeEach
public void setUp() {
MockitoAnnotations.initMocks(this);
initiationService = new BasePaymentInitiationService(ASPSP, httpClient, Collections.singletonList(interceptor));
}
@Test
void initiatePayment_singlePaymentsSepaCreditTransfers() {
PaymentInitiationJson body = new PaymentInitiationJson();
PaymentInitationRequestResponse201 example = new PaymentInitationRequestResponse201();
when(httpClient.post(any())).thenReturn(requestBuilder);
doReturn(dummyResponse(example)).when(requestBuilder).send(any(), eq(Collections.singletonList(interceptor)));
Response<PaymentInitationRequestResponse201> response
= initiationService.initiatePayment(PAYMENT_SERVICE, SEPA_CREDIT_TRANSFERS, headers, RequestParams.empty(), body);
verify(httpClient, times(1)).post(uriCaptor.capture());
verify(requestBuilder, times(1)).jsonBody(bodyCaptor.capture());
verify(requestBuilder, times(1)).headers(headersCaptor.capture());
verify(requestBuilder, times(1)).send(any(), eq(Collections.singletonList(interceptor)));
assertThat(uriCaptor.getValue()).isEqualTo(PAYMENTS_URI + "/" + SEPA_CREDIT_TRANSFERS);
assertThat(bodyCaptor.getValue()).isEqualTo("{}");
assertThat(headersCaptor.getValue()).isEqualTo(headers.toMap());
assertThat(response.getBody()).isEqualTo(example);
}
@Test
void initiatePayment_singlePaymentsPainSepaCreditTransfers() {
Object body = "body";
PaymentInitationRequestResponse201 example = new PaymentInitationRequestResponse201();
when(httpClient.post(any())).thenReturn(requestBuilder);
doReturn(dummyResponse(example)).when(requestBuilder).send(any(), eq(Collections.singletonList(interceptor)));
Response<PaymentInitationRequestResponse201> response
= initiationService.initiatePayment(PAYMENT_SERVICE, PAIN_SEPA_CREDIT_TRANSFERS, headers, RequestParams.empty(), body);
verify(httpClient, times(1)).post(uriCaptor.capture());
verify(requestBuilder, times(1)).xmlBody(bodyCaptor.capture());
verify(requestBuilder, times(1)).send(any(), eq(Collections.singletonList(interceptor)));
assertThat(uriCaptor.getValue()).isEqualTo(PAYMENTS_URI + "/" + PAIN_SEPA_CREDIT_TRANSFERS);
assertThat(bodyCaptor.getValue()).isEqualTo("body");
assertThat(response.getBody()).isEqualTo(example);
}
@Test
void getSinglePaymentInformation() {
PaymentInitiationWithStatusResponse example = new PaymentInitiationWithStatusResponse();
when(httpClient.get(any())).thenReturn(requestBuilder);
doReturn(dummyResponse(example)).when(requestBuilder).send(any(), eq(Collections.singletonList(interceptor)));
Response<PaymentInitiationWithStatusResponse> response
= initiationService.getSinglePaymentInformation(SEPA_CREDIT_TRANSFERS, PAYMENTID, headers, RequestParams.empty());
verify(httpClient, times(1)).get(uriCaptor.capture());
verify(requestBuilder, times(1)).headers(headersCaptor.capture());
verify(requestBuilder, times(1)).send(any(), eq(Collections.singletonList(interceptor)));
assertThat(uriCaptor.getValue()).isEqualTo(PAYMENTS_URI + "/" + SEPA_CREDIT_TRANSFERS + "/" + PAYMENTID);
assertThat(headersCaptor.getValue()).isEqualTo(headers.toMap());
assertThat(response.getBody()).isEqualTo(example);
}
@Test
void getPaymentInitiationScaStatus() {
ScaStatusResponse example = new ScaStatusResponse();
when(httpClient.get(any())).thenReturn(requestBuilder);
doReturn(dummyResponse(example)).when(requestBuilder).send(any(), eq(Collections.singletonList(interceptor)));
Response<ScaStatusResponse> response = initiationService.getPaymentInitiationScaStatus(PAYMENT_SERVICE,
SEPA_CREDIT_TRANSFERS,
PAYMENTID,
AUTHORISATIONID,
RequestHeaders.empty(),
RequestParams.empty());
verify(httpClient, times(1)).get(uriCaptor.capture());
verify(requestBuilder, times(1)).headers(headersCaptor.capture());
verify(requestBuilder, times(1)).send(any(), eq(Collections.singletonList(interceptor)));
assertThat(uriCaptor.getValue())
.isEqualTo(PAYMENTS_URI + "/" + SEPA_CREDIT_TRANSFERS + "/" + PAYMENTID + "/authorisations/" + AUTHORISATIONID);
assertThat(headersCaptor.getValue()).isEqualTo(headers.toMap());
assertThat(response.getBody()).isEqualTo(example);
}
@Test
void getPaymentInitiationStatus() {
PaymentInitiationStatusResponse200Json example = new PaymentInitiationStatusResponse200Json();
when(httpClient.get(any())).thenReturn(requestBuilder);
doReturn(dummyResponse(example)).when(requestBuilder).send(any(), eq(Collections.singletonList(interceptor)));
Response<PaymentInitiationStatusResponse200Json> response = initiationService.getPaymentInitiationStatus(
PAYMENT_SERVICE,
SEPA_CREDIT_TRANSFERS,
PAYMENTID,
headers,
RequestParams.empty());
verify(httpClient, times(1)).get(uriCaptor.capture());
verify(requestBuilder, times(1)).headers(headersCaptor.capture());
verify(requestBuilder, times(1)).send(any(), eq(Collections.singletonList(interceptor)));
assertThat(uriCaptor.getValue()).isEqualTo(PAYMENTS_URI + "/" + SEPA_CREDIT_TRANSFERS + "/" + PAYMENTID + "/status");
assertThat(headersCaptor.getValue()).isEqualTo(headers.toMap());
assertThat(response.getBody()).isEqualTo(example);
}
@Test
void getSinglePaymentInitiationStatus_asString() {
String example = "statusResponse";
when(httpClient.get(any())).thenReturn(requestBuilder);
doReturn(dummyResponse(example)).when(requestBuilder).send(any(), eq(Collections.singletonList(interceptor)));
Response<String> response = initiationService.getPaymentInitiationStatusAsString(
PAYMENT_SERVICE,
SEPA_CREDIT_TRANSFERS,
PAYMENTID,
headers,
RequestParams.empty());
verify(httpClient, times(1)).get(uriCaptor.capture());
verify(requestBuilder, times(1)).headers(headersCaptor.capture());
verify(requestBuilder, times(1)).send(any(), eq(Collections.singletonList(interceptor)));
assertThat(uriCaptor.getValue()).isEqualTo(PAYMENTS_URI + "/" + SEPA_CREDIT_TRANSFERS + "/" + PAYMENTID + "/status");
assertThat(headersCaptor.getValue()).isEqualTo(headers.toMap());
assertThat(response.getBody()).isEqualTo(example);
}
@Test
void getPaymentInitiationAuthorisation() {
Authorisations example = new Authorisations();
when(httpClient.get(any())).thenReturn(requestBuilder);
doReturn(dummyResponse(example)).when(requestBuilder).send(any(), eq(Collections.singletonList(interceptor)));
Response<Authorisations> response = initiationService.getPaymentInitiationAuthorisation(PAYMENT_SERVICE,
SEPA_CREDIT_TRANSFERS,
PAYMENTID,
RequestHeaders.empty(),
RequestParams.empty());
verify(httpClient, times(1)).get(uriCaptor.capture());
verify(requestBuilder, times(1)).headers(headersCaptor.capture());
verify(requestBuilder, times(1)).send(any(), eq(Collections.singletonList(interceptor)));
assertThat(uriCaptor.getValue()).isEqualTo(PAYMENTS_URI + "/" + SEPA_CREDIT_TRANSFERS + "/" + PAYMENTID + "/authorisations");
assertThat(headersCaptor.getValue()).isEqualTo(headers.toMap());
assertThat(response.getBody()).isEqualTo(example);
}
@Test
void startSinglePaymentAuthorisation() {
UpdatePsuAuthentication body = new UpdatePsuAuthentication();
StartScaprocessResponse example = new StartScaprocessResponse();
when(httpClient.post(any())).thenReturn(requestBuilder);
doReturn(dummyResponse(example)).when(requestBuilder).send(any(), eq(Collections.singletonList(interceptor)));
Response<StartScaprocessResponse> response =
initiationService.startPaymentAuthorisation(PAYMENT_SERVICE,
SEPA_CREDIT_TRANSFERS,
PAYMENTID,
headers,
RequestParams.empty(),
body);
verify(httpClient, times(1)).post(uriCaptor.capture());
verify(requestBuilder, times(1)).jsonBody(bodyCaptor.capture());
verify(requestBuilder, times(1)).headers(headersCaptor.capture());
verify(requestBuilder, times(1)).send(any(), eq(Collections.singletonList(interceptor)));
assertThat(uriCaptor.getValue()).isEqualTo(PAYMENTS_URI + "/" + SEPA_CREDIT_TRANSFERS + "/" + PAYMENTID + "/authorisations");
assertThat(bodyCaptor.getValue()).isEqualTo("{}");
assertThat(headersCaptor.getValue()).isEqualTo(headers.toMap());
assertThat(response.getBody()).isEqualTo(example);
}
@Test
void updatePaymentPsuData_passwordStage() {
UpdatePsuAuthentication body = new UpdatePsuAuthentication();
UpdatePsuAuthenticationResponse example = new UpdatePsuAuthenticationResponse();
when(httpClient.put(any())).thenReturn(requestBuilder);
doReturn(dummyResponse(example)).when(requestBuilder).send(any(), eq(Collections.singletonList(interceptor)));
Response<UpdatePsuAuthenticationResponse> response =
initiationService.updatePaymentPsuData(PAYMENT_SERVICE,
SEPA_CREDIT_TRANSFERS,
PAYMENTID,
AUTHORISATIONID,
headers,
RequestParams.empty(),
body);
verify(httpClient, times(1)).put(uriCaptor.capture());
verify(requestBuilder, times(1)).jsonBody(bodyCaptor.capture());
verify(requestBuilder, times(1)).headers(headersCaptor.capture());
verify(requestBuilder, times(1)).send(any(), eq(Collections.singletonList(interceptor)));
assertThat(uriCaptor.getValue()).isEqualTo(UPDATE_PAYMENT_PSU_DATA_URI);
assertThat(bodyCaptor.getValue()).isEqualTo("{}");
assertThat(headersCaptor.getValue()).isEqualTo(headers.toMap());
assertThat(response.getBody()).isEqualTo(example);
}
@Test
void updatePaymentPsuData_selectScaMethodStage() {
SelectPsuAuthenticationMethod body = new SelectPsuAuthenticationMethod();
SelectPsuAuthenticationMethodResponse example = new SelectPsuAuthenticationMethodResponse();
when(httpClient.put(any())).thenReturn(requestBuilder);
doReturn(dummyResponse(example)).when(requestBuilder).send(any(), eq(Collections.singletonList(interceptor)));
Response<SelectPsuAuthenticationMethodResponse> response =
initiationService.updatePaymentPsuData(PAYMENT_SERVICE,
SEPA_CREDIT_TRANSFERS,
PAYMENTID,
AUTHORISATIONID,
headers,
RequestParams.empty(),
body);
verify(httpClient, times(1)).put(uriCaptor.capture());
verify(requestBuilder, times(1)).jsonBody(bodyCaptor.capture());
verify(requestBuilder, times(1)).headers(headersCaptor.capture());
verify(requestBuilder, times(1)).send(any(), eq(Collections.singletonList(interceptor)));
assertThat(uriCaptor.getValue()).isEqualTo(UPDATE_PAYMENT_PSU_DATA_URI);
assertThat(bodyCaptor.getValue()).isEqualTo("{}");
assertThat(headersCaptor.getValue()).isEqualTo(headers.toMap());
assertThat(response.getBody()).isEqualTo(example);
}
@Test
void updatePaymentPsuData_otpStage() {
TransactionAuthorisation body = new TransactionAuthorisation();
ScaStatusResponse example = new ScaStatusResponse();
when(httpClient.put(any())).thenReturn(requestBuilder);
doReturn(dummyResponse(example)).when(requestBuilder).send(any(), eq(Collections.singletonList(interceptor)));
Response<ScaStatusResponse> response =
initiationService.updatePaymentPsuData(PAYMENT_SERVICE,
SEPA_CREDIT_TRANSFERS,
PAYMENTID,
AUTHORISATIONID,
headers,
RequestParams.empty(),
body);
verify(httpClient, times(1)).put(uriCaptor.capture());
verify(requestBuilder, times(1)).jsonBody(bodyCaptor.capture());
verify(requestBuilder, times(1)).headers(headersCaptor.capture());
verify(requestBuilder, times(1)).send(any(), eq(Collections.singletonList(interceptor)));
assertThat(uriCaptor.getValue()).isEqualTo(UPDATE_PAYMENT_PSU_DATA_URI);
assertThat(bodyCaptor.getValue()).isEqualTo("{}");
assertThat(headersCaptor.getValue()).isEqualTo(headers.toMap());
assertThat(response.getBody()).isEqualTo(example);
}
private <T> Response<T> dummyResponse(T body) {
return new Response<>(-1, body, null);
}
private static Aspsp buildAspspWithUrls() {
Aspsp aspsp = new Aspsp();
aspsp.setUrl(BASE_URI);
aspsp.setIdpUrl(IDP_URL);
return aspsp;
}
}
| 17,917 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
BaseAccountInformationServiceTest.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/test/java/de/adorsys/xs2a/adapter/impl/BaseAccountInformationServiceTest.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl;
import de.adorsys.xs2a.adapter.api.RequestHeaders;
import de.adorsys.xs2a.adapter.api.RequestParams;
import de.adorsys.xs2a.adapter.api.Response;
import de.adorsys.xs2a.adapter.api.http.ContentType;
import de.adorsys.xs2a.adapter.api.http.HttpClient;
import de.adorsys.xs2a.adapter.api.http.Interceptor;
import de.adorsys.xs2a.adapter.api.http.Request;
import de.adorsys.xs2a.adapter.api.model.*;
import de.adorsys.xs2a.adapter.impl.http.RequestBuilderImpl;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.*;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.*;
class BaseAccountInformationServiceTest {
private static final String BASE_URI = "baseUri";
private static final String IDP_URL = "https://idp.url";
private static final String CONSENTID = "consentId";
private static final String AUTHORISATIONID = "authorisationId";
private static final String ACCOUNTID = "accountId";
public static final String PSU_AUTHORISATION_URI = BASE_URI + "/v1/consents/" + CONSENTID;
public static final String UPDATE_PSU_AUTHORISATION_URI = PSU_AUTHORISATION_URI +
"/authorisations/" + AUTHORISATIONID;
public static final String TRANSACTION_LIST_URI = BASE_URI + "/v1/accounts/" + ACCOUNTID
+ "/transactions";
private static final Aspsp ASPSP = buildAspspWithUrls();
private static Consents body = buildConsent();
private static UpdatePsuAuthentication updatePsuAuthentication = new UpdatePsuAuthentication();
private static RequestHeaders headers = RequestHeaders.fromMap(new HashMap<>());
private static RequestParams params = RequestParams.builder().build();
private BaseAccountInformationService informationService;
@Mock
private HttpClient httpClient;
@Spy
private Request.Builder requestBuilder = new RequestBuilderImpl(httpClient, null, null);
@Mock
private Interceptor interceptor;
@Captor
ArgumentCaptor<Map<String, String>> headersCaptor;
@Captor
ArgumentCaptor<String> uriCaptor, bodyCaptor;
@Captor
ArgumentCaptor<Boolean> booleanArgumentCaptor;
@BeforeEach
public void setUp() {
MockitoAnnotations.initMocks(this);
informationService = new BaseAccountInformationService(ASPSP, httpClient, Collections.singletonList(interceptor));
}
@Test
void createConsent() {
ConsentsResponse201 example = new ConsentsResponse201();
when(httpClient.post(any())).thenReturn(requestBuilder);
doReturn(dummyResponse(example)).when(requestBuilder).send(any(), eq(Collections.singletonList(interceptor)));
Response<ConsentsResponse201> response = informationService.createConsent(headers, params, body);
verify(httpClient, times(1)).post(uriCaptor.capture());
verify(requestBuilder, times(1)).headers(headersCaptor.capture());
verify(requestBuilder, times(1)).jsonBody(bodyCaptor.capture());
verify(requestBuilder, times(1)).send(any(), eq(Collections.singletonList(interceptor)));
assertThat(uriCaptor.getValue()).isEqualTo(BASE_URI + "/v1/consents");
assertThat(headersCaptor.getValue()).isEqualTo(informationService.resolvePsuIdHeader(headers.toMap()));
assertThat(bodyCaptor.getValue()).isEqualTo("{}");
assertThat(response.getBody()).isEqualTo(example);
}
@Test
void getConsentInformation() {
ConsentInformationResponse200Json example = new ConsentInformationResponse200Json();
when(httpClient.get(any())).thenReturn(requestBuilder);
doReturn(dummyResponse(example)).when(requestBuilder).send(any(),
eq(Collections.singletonList(interceptor)));
Response<ConsentInformationResponse200Json> response = informationService.getConsentInformation(CONSENTID, headers, params);
verify(httpClient, times(1)).get(uriCaptor.capture());
verify(requestBuilder, times(1)).headers(headersCaptor.capture());
verify(requestBuilder, times(1)).send(any(), eq(Collections.singletonList(interceptor)));
assertThat(uriCaptor.getValue()).isEqualTo(PSU_AUTHORISATION_URI);
assertThat(headersCaptor.getValue()).isEqualTo(headers.toMap());
assertThat(response.getBody()).isEqualTo(example);
}
@Test
void deleteConsent() {
when(httpClient.delete(any())).thenReturn(requestBuilder);
doReturn(dummyResponse(Void.class)).when(requestBuilder).send(any(), eq(Collections.singletonList(interceptor)));
informationService.deleteConsent(CONSENTID, headers, params);
verify(httpClient, times(1)).delete(uriCaptor.capture());
verify(requestBuilder, times(1)).headers(headersCaptor.capture());
verify(requestBuilder, times(1)).send(any(), eq(Collections.singletonList(interceptor)));
assertThat(uriCaptor.getValue()).isEqualTo(PSU_AUTHORISATION_URI);
assertThat(headersCaptor.getValue()).isEqualTo(headers.toMap());
}
@Test
void getConsentStatus() {
ConsentStatusResponse200 example = new ConsentStatusResponse200();
when(httpClient.get(any())).thenReturn(requestBuilder);
doReturn(dummyResponse(example)).when(requestBuilder).send(any(), eq(Collections.singletonList(interceptor)));
Response<ConsentStatusResponse200> response = informationService.getConsentStatus(CONSENTID, headers, params);
verify(httpClient, times(1)).get(uriCaptor.capture());
verify(requestBuilder, times(1)).headers(headersCaptor.capture());
verify(requestBuilder, times(1)).send(any(), eq(Collections.singletonList(interceptor)));
assertThat(uriCaptor.getValue()).isEqualTo(PSU_AUTHORISATION_URI + "/status");
assertThat(headersCaptor.getValue()).isEqualTo(headers.toMap());
assertThat(response.getBody()).isEqualTo(example);
}
@Test
void getConsentAuthorisation() {
Authorisations example = new Authorisations();
when(httpClient.get(any())).thenReturn(requestBuilder);
doReturn(dummyResponse(example)).when(requestBuilder).send(any(), eq(Collections.singletonList(interceptor)));
Response<Authorisations> response = informationService.getConsentAuthorisation(CONSENTID, headers, params);
verify(httpClient, times(1)).get(uriCaptor.capture());
verify(requestBuilder, times(1)).headers(headersCaptor.capture());
verify(requestBuilder, times(1)).send(any(), eq(Collections.singletonList(interceptor)));
assertThat(uriCaptor.getValue()).isEqualTo(PSU_AUTHORISATION_URI + "/authorisations");
assertThat(headersCaptor.getValue()).isEqualTo(headers.toMap());
assertThat(response.getBody()).isEqualTo(example);
}
@Test
void startConsentAuthorisation() {
StartScaprocessResponse example = new StartScaprocessResponse();
when(httpClient.post(any())).thenReturn(requestBuilder);
doReturn(dummyResponse(example)).when(requestBuilder).send(any(), eq(Collections.singletonList(interceptor)));
Response<StartScaprocessResponse> response =
informationService.startConsentAuthorisation(CONSENTID, headers, params);
verify(httpClient, times(1)).post(uriCaptor.capture());
verify(requestBuilder, times(1)).headers(headersCaptor.capture());
verify(requestBuilder, times(1)).emptyBody(booleanArgumentCaptor.capture());
verify(requestBuilder, times(1)).send(any(), eq(Collections.singletonList(interceptor)));
assertThat(uriCaptor.getValue()).isEqualTo(PSU_AUTHORISATION_URI + "/authorisations");
assertThat(headersCaptor.getValue()).isEqualTo(headers.toMap());
assertThat(booleanArgumentCaptor.getValue()).isTrue();
assertThat(response.getBody()).isEqualTo(example);
}
@Test
void startConsentAuthorisation_updatePsuAuthentication() {
StartScaprocessResponse example = new StartScaprocessResponse();
when(httpClient.post(any())).thenReturn(requestBuilder);
doReturn(dummyResponse(example)).when(requestBuilder).send(any(), eq(Collections.singletonList(interceptor)));
Response<StartScaprocessResponse> response =
informationService.startConsentAuthorisation(CONSENTID, headers, params, updatePsuAuthentication);
verify(httpClient, times(1)).post(uriCaptor.capture());
verify(requestBuilder, times(1)).headers(headersCaptor.capture());
verify(requestBuilder, times(1)).jsonBody(bodyCaptor.capture());
verify(requestBuilder, times(1)).send(any(), eq(Collections.singletonList(interceptor)));
assertThat(uriCaptor.getValue()).isEqualTo(PSU_AUTHORISATION_URI + "/authorisations");
assertThat(headersCaptor.getValue()).isEqualTo(headers.toMap());
assertThat(bodyCaptor.getValue()).isEqualTo("{}");
assertThat(response.getBody()).isEqualTo(example);
}
@Test
void updateConsentsPsuData_updatePsuAuthentication() {
UpdatePsuAuthenticationResponse example = new UpdatePsuAuthenticationResponse();
when(httpClient.put(any())).thenReturn(requestBuilder);
doReturn(dummyResponse(example)).when(requestBuilder).send(any(), eq(Collections.singletonList(interceptor)));
Response<UpdatePsuAuthenticationResponse> response = informationService.updateConsentsPsuData(CONSENTID,
AUTHORISATIONID,
headers,
params,
updatePsuAuthentication);
verify(httpClient, times(1)).put(uriCaptor.capture());
verify(requestBuilder, times(1)).headers(headersCaptor.capture());
verify(requestBuilder, times(1)).jsonBody(bodyCaptor.capture());
verify(requestBuilder, times(1)).send(any(), eq(Collections.singletonList(interceptor)));
assertThat(uriCaptor.getValue()).isEqualTo(UPDATE_PSU_AUTHORISATION_URI);
assertThat(headersCaptor.getValue()).isEqualTo(headers.toMap());
assertThat(bodyCaptor.getValue()).isEqualTo("{}");
assertThat(response.getBody()).isEqualTo(example);
}
@Test
void updateConsentsPsuData_selectPsuAuthenticationMethodResponse() {
SelectPsuAuthenticationMethod selectPsuAuthenticationMethod = new SelectPsuAuthenticationMethod();
SelectPsuAuthenticationMethodResponse example = new SelectPsuAuthenticationMethodResponse();
when(httpClient.put(any())).thenReturn(requestBuilder);
doReturn(dummyResponse(example)).when(requestBuilder).send(any(), eq(Collections.singletonList(interceptor)));
Response<SelectPsuAuthenticationMethodResponse> response = informationService.updateConsentsPsuData(CONSENTID,
AUTHORISATIONID,
headers,
params,
selectPsuAuthenticationMethod);
verify(httpClient, times(1)).put(uriCaptor.capture());
verify(requestBuilder, times(1)).headers(headersCaptor.capture());
verify(requestBuilder, times(1)).jsonBody(bodyCaptor.capture());
verify(requestBuilder, times(1)).send(any(), eq(Collections.singletonList(interceptor)));
assertThat(uriCaptor.getValue()).isEqualTo(UPDATE_PSU_AUTHORISATION_URI);
assertThat(headersCaptor.getValue()).isEqualTo(headers.toMap());
assertThat(bodyCaptor.getValue()).isEqualTo("{}");
assertThat(response.getBody()).isEqualTo(example);
}
@Test
void updateConsentsPsuData_transactionAuthorisation() {
TransactionAuthorisation transactionAuthorisation = new TransactionAuthorisation();
ScaStatusResponse example = new ScaStatusResponse();
when(httpClient.put(any())).thenReturn(requestBuilder);
doReturn(dummyResponse(example)).when(requestBuilder).send(any(), eq(Collections.singletonList(interceptor)));
Response<ScaStatusResponse> response = informationService.updateConsentsPsuData(CONSENTID,
AUTHORISATIONID,
headers,
params,
transactionAuthorisation);
verify(httpClient, times(1)).put(uriCaptor.capture());
verify(requestBuilder, times(1)).headers(headersCaptor.capture());
verify(requestBuilder, times(1)).jsonBody(bodyCaptor.capture());
verify(requestBuilder, times(1)).send(any(), eq(Collections.singletonList(interceptor)));
assertThat(uriCaptor.getValue()).isEqualTo(UPDATE_PSU_AUTHORISATION_URI);
assertThat(headersCaptor.getValue()).isEqualTo(headers.toMap());
assertThat(bodyCaptor.getValue()).isEqualTo("{}");
assertThat(response.getBody()).isEqualTo(example);
}
@Test
void getAccountList() {
AccountList example = new AccountList();
when(httpClient.get(any())).thenReturn(requestBuilder);
doReturn(dummyResponse(example)).when(requestBuilder).send(any(), eq(Collections.singletonList(interceptor)));
Response<AccountList> response
= informationService.getAccountList(headers, params);
verify(httpClient, times(1)).get(uriCaptor.capture());
verify(requestBuilder, times(1)).headers(headersCaptor.capture());
verify(requestBuilder, times(1)).send(any(), eq(Collections.singletonList(interceptor)));
assertThat(uriCaptor.getValue()).isEqualTo(AbstractService.buildUri(BASE_URI + "/v1/accounts", params));
assertThat(headersCaptor.getValue()).isEqualTo(informationService.addConsentIdHeader(headers.toMap()));
assertThat(response.getBody()).isEqualTo(example);
}
@Test
void readAccountDetails() {
OK200AccountDetails example = new OK200AccountDetails();
when(httpClient.get(any())).thenReturn(requestBuilder);
doReturn(dummyResponse(example)).when(requestBuilder).send(any(), eq(Collections.singletonList(interceptor)));
String accountId = "accountId";
Response<OK200AccountDetails> response
= informationService.readAccountDetails(accountId, headers, params);
verify(httpClient, times(1)).get(uriCaptor.capture());
verify(requestBuilder, times(1)).headers(headersCaptor.capture());
verify(requestBuilder, times(1)).send(any(), eq(Collections.singletonList(interceptor)));
assertThat(uriCaptor.getValue()).isEqualTo(AbstractService.buildUri(
BASE_URI + "/v1/accounts/" + accountId, params));
assertThat(headersCaptor.getValue()).isEqualTo(informationService.addConsentIdHeader(headers.toMap()));
assertThat(response.getBody()).isEqualTo(example);
}
@Test
void getTransactionList() {
TransactionsResponse200Json example = new TransactionsResponse200Json();
Map<String, String> transactionHeaders = headers.toMap();
transactionHeaders.put(RequestHeaders.ACCEPT, ContentType.APPLICATION_JSON);
when(httpClient.get(any())).thenReturn(requestBuilder);
doReturn(dummyResponse(example)).when(requestBuilder).send(any(), eq(Collections.singletonList(interceptor)));
Response<TransactionsResponse200Json> response
= informationService.getTransactionList(ACCOUNTID, headers, params);
verify(httpClient, times(1)).get(uriCaptor.capture());
verify(requestBuilder, times(1)).headers(headersCaptor.capture());
verify(requestBuilder, times(1)).send(any(), eq(Collections.singletonList(interceptor)));
assertThat(uriCaptor.getValue()).isEqualTo(AbstractService.buildUri(TRANSACTION_LIST_URI, params));
assertThat(headersCaptor.getValue()).isEqualTo(transactionHeaders);
assertThat(response.getBody()).isEqualTo(example);
}
@Test
void getTransactionDetails() {
OK200TransactionDetails example = new OK200TransactionDetails();
String transactionId = "transactionId";
when(httpClient.get(any())).thenReturn(requestBuilder);
doReturn(dummyResponse(example)).when(requestBuilder).send(any(), eq(Collections.singletonList(interceptor)));
Response<OK200TransactionDetails> response
= informationService.getTransactionDetails(ACCOUNTID, transactionId, headers, params);
verify(httpClient, times(1)).get(uriCaptor.capture());
verify(requestBuilder, times(1)).headers(headersCaptor.capture());
verify(requestBuilder, times(1)).send(any(), eq(Collections.singletonList(interceptor)));
assertThat(uriCaptor.getValue()).isEqualTo(TRANSACTION_LIST_URI + "/" + transactionId);
assertThat(headersCaptor.getValue()).isEqualTo(headers.toMap());
assertThat(response.getBody()).isEqualTo(example);
}
@Test
void getTransactionListAsString() {
String example = "list of transactions";
when(httpClient.get(any())).thenReturn(requestBuilder);
doReturn(dummyResponse(example)).when(requestBuilder).send(any(), eq(Collections.singletonList(interceptor)));
Response<String> response
= informationService.getTransactionListAsString(ACCOUNTID, headers, params);
verify(httpClient, times(1)).get(uriCaptor.capture());
verify(requestBuilder, times(1)).headers(headersCaptor.capture());
verify(requestBuilder, times(1)).send(any(), eq(Collections.singletonList(interceptor)));
assertThat(uriCaptor.getValue()).isEqualTo(AbstractService.buildUri(TRANSACTION_LIST_URI, params));
assertThat(headersCaptor.getValue()).isEqualTo(headers.toMap());
assertThat(response.getBody()).isEqualTo(example);
}
@Test
void getConsentScaStatus() {
ScaStatusResponse example = new ScaStatusResponse();
when(httpClient.get(any())).thenReturn(requestBuilder);
doReturn(dummyResponse(example)).when(requestBuilder).send(any(), eq(Collections.singletonList(interceptor)));
Response<ScaStatusResponse> response
= informationService.getConsentScaStatus(CONSENTID, AUTHORISATIONID, headers, params);
verify(httpClient, times(1)).get(uriCaptor.capture());
verify(requestBuilder, times(1)).headers(headersCaptor.capture());
verify(requestBuilder, times(1)).send(any(), eq(Collections.singletonList(interceptor)));
assertThat(uriCaptor.getValue()).isEqualTo(UPDATE_PSU_AUTHORISATION_URI);
assertThat(headersCaptor.getValue()).isEqualTo(headers.toMap());
assertThat(response.getBody()).isEqualTo(example);
}
@Test
void getBalances() {
ReadAccountBalanceResponse200 example = new ReadAccountBalanceResponse200();
when(httpClient.get(any())).thenReturn(requestBuilder);
doReturn(dummyResponse(example)).when(requestBuilder).send(any(), eq(Collections.singletonList(interceptor)));
Response<ReadAccountBalanceResponse200> response
= informationService.getBalances(ACCOUNTID, headers, params);
verify(httpClient, times(1)).get(uriCaptor.capture());
verify(requestBuilder, times(1)).headers(headersCaptor.capture());
verify(requestBuilder, times(1)).send(any(), eq(Collections.singletonList(interceptor)));
assertThat(uriCaptor.getValue()).isEqualTo(BASE_URI + "/v1/accounts/" + ACCOUNTID + "/balances");
assertThat(headersCaptor.getValue()).isEqualTo(headers.toMap());
assertThat(response.getBody()).isEqualTo(example);
}
@Test
void getConsentBaseUri() {
assertThat(informationService.getConsentBaseUri()).isEqualTo("baseUri/v1/consents");
}
@Test
void getAccountsBaseUri() {
assertThat(informationService.getAccountsBaseUri()).isEqualTo("baseUri/v1/accounts");
}
@Test
void getIdpUri() {
assertThat(informationService.getIdpUri()).isEqualTo(IDP_URL);
}
private static Aspsp buildAspspWithUrls() {
Aspsp aspsp = new Aspsp();
aspsp.setUrl(BASE_URI);
aspsp.setIdpUrl(IDP_URL);
return aspsp;
}
private static Consents buildConsent() {
return new Consents();
}
private <T> Response<T> dummyResponse(T body) {
return new Response<>(0, body, null);
}
}
| 22,258 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
BaseOauth2ServiceTest.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/test/java/de/adorsys/xs2a/adapter/impl/BaseOauth2ServiceTest.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl;
import de.adorsys.xs2a.adapter.api.Oauth2Service;
import de.adorsys.xs2a.adapter.api.Oauth2Service.Parameters;
import de.adorsys.xs2a.adapter.api.Response;
import de.adorsys.xs2a.adapter.api.ResponseHeaders;
import de.adorsys.xs2a.adapter.api.http.HttpClient;
import de.adorsys.xs2a.adapter.api.model.Aspsp;
import de.adorsys.xs2a.adapter.api.model.TokenResponse;
import de.adorsys.xs2a.adapter.impl.http.ApacheHttpClient;
import de.adorsys.xs2a.adapter.impl.oauth2.api.model.AuthorisationServerMetaData;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
import java.io.IOException;
import java.net.URI;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import static org.junit.jupiter.api.Assertions.assertEquals;
class BaseOauth2ServiceTest {
private static final String SCA_OAUTH_LINK = "https://example.com/.well-known";
private static final String TOKEN_ENDPOINT = "https://server.example.com/token";
private static final String ACCESS_TOKEN = "access token";
private static final String IDP_URL = "https://server.example.com/idp";
private static final String AUTHORISATION_ENDPOINT = "https://authorisation.endpoint";
private static final String STATE = "state";
private static final String REDIRECT_URI = "https://redirect.uri?param1=a¶m2=b¶m3=c";
private Parameters parameters = buildParametersWithScaOauthLink();
private BaseOauth2Service oauth2Service;
@Spy
private HttpClient httpClient = new ApacheHttpClient(null, null);
@BeforeEach
public void setUp() {
MockitoAnnotations.initMocks(this);
oauth2Service = new BaseOauth2Service(buildAspspWithIdpUrl(), httpClient);
}
@Test
void scaOauthLinkUsedForAuthorizationServerMetadataResolution() throws IOException {
Mockito.doReturn(authorizationServerMetadata())
.when(httpClient).send(Mockito.argThat(req -> req.uri().equals(SCA_OAUTH_LINK)), Mockito.any());
oauth2Service.getAuthorizationRequestUri(null, parameters);
Mockito.verify(httpClient, Mockito.times(1))
.send(Mockito.argThat(req -> req.uri().equals(SCA_OAUTH_LINK)), Mockito.any());
}
@Test
void authorizationServerMetadataResolutionFallsBackToIdpUrlWhenScaOauthLinkIsMissing() throws IOException {
Mockito.doReturn(authorizationServerMetadata())
.when(httpClient).send(Mockito.argThat(req -> req.uri().equals(IDP_URL)), Mockito.any());
oauth2Service.getAuthorizationRequestUri(null, new Parameters());
Mockito.verify(httpClient, Mockito.times(1))
.send(Mockito.argThat(req -> req.uri().equals(IDP_URL)), Mockito.any());
}
@Test
void getAuthorizationEndpoint_withAuthorisationEndpoint() throws IOException {
parameters.setAuthorizationEndpoint(AUTHORISATION_ENDPOINT);
parameters.setState(STATE);
parameters.setRedirectUri(REDIRECT_URI);
String expectedAuthorisationRequestUri = AUTHORISATION_ENDPOINT + "?" +
Parameters.RESPONSE_TYPE + "=" + Oauth2Service.ResponseType.CODE.toString() +
"&" + Parameters.STATE + "=" + STATE +
"&" + Parameters.REDIRECT_URI + "=" + URLEncoder.encode(REDIRECT_URI, StandardCharsets.UTF_8.name());
URI actual = oauth2Service.getAuthorizationRequestUri(null, parameters);
assertEquals(expectedAuthorisationRequestUri, actual.toString());
}
@Test
void getToken_withAvailableScaOauthLink() throws IOException {
Mockito.doReturn(authorizationServerMetadata())
.when(httpClient).send(Mockito.argThat(req -> req.uri().equals(SCA_OAUTH_LINK)), Mockito.any());
Mockito.doReturn(tokenResponse())
.when(httpClient).send(Mockito.argThat(req -> req.uri().equals(TOKEN_ENDPOINT)), Mockito.any());
TokenResponse actual = oauth2Service.getToken(null, parameters);
Mockito.verify(httpClient, Mockito.times(2))
.send(Mockito.any(), Mockito.any());
assertEquals(ACCESS_TOKEN, actual.getAccessToken());
}
@Test
void getToken_withAvailableTokenEndpoint() throws IOException {
parameters.setTokenEndpoint(TOKEN_ENDPOINT);
Mockito.doReturn(tokenResponse()).when(httpClient).send(Mockito.any(), Mockito.any());
TokenResponse actual = oauth2Service.getToken(null, parameters);
Mockito.verify(httpClient, Mockito.times(1))
.send(Mockito.any(), Mockito.any());
assertEquals(ACCESS_TOKEN, actual.getAccessToken());
}
private Response<AuthorisationServerMetaData> authorizationServerMetadata() {
AuthorisationServerMetaData metadata = new AuthorisationServerMetaData();
metadata.setAuthorisationEndpoint("https://server.example.com/authorize");
metadata.setTokenEndpoint(TOKEN_ENDPOINT);
return new Response<>(200, metadata, ResponseHeaders.emptyResponseHeaders());
}
private Response<TokenResponse> tokenResponse() {
TokenResponse tokenResponse = new TokenResponse();
tokenResponse.setAccessToken(ACCESS_TOKEN);
return new Response<>(200, tokenResponse, ResponseHeaders.emptyResponseHeaders());
}
private Aspsp buildAspspWithIdpUrl() {
Aspsp aspsp = new Aspsp();
aspsp.setIdpUrl(IDP_URL);
return aspsp;
}
private Parameters buildParametersWithScaOauthLink() {
Parameters params = new Parameters();
params.setScaOAuthLink(SCA_OAUTH_LINK);
return params;
}
}
| 6,499 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
PkceOauth2ServiceTest.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/test/java/de/adorsys/xs2a/adapter/impl/PkceOauth2ServiceTest.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl;
import de.adorsys.xs2a.adapter.api.Oauth2Service;
import de.adorsys.xs2a.adapter.api.Oauth2Service.GrantType;
import de.adorsys.xs2a.adapter.api.Oauth2Service.Parameters;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import java.io.IOException;
import java.net.URI;
class PkceOauth2ServiceTest {
Oauth2Service oauth2Service = Mockito.mock(Oauth2Service.class);
PkceOauth2Service pkceOauth2Service = new PkceOauth2Service(oauth2Service) {
@Override
public String codeChallenge() {
return "1234";
}
};
Parameters parameters = new Parameters();
@Test
void codeVerifierParameterAddedForAuthorizationCodeExchange() throws IOException {
parameters.setGrantType(GrantType.AUTHORIZATION_CODE.toString());
pkceOauth2Service.getToken(null, parameters);
Mockito.verify(oauth2Service, Mockito.times(1))
.getToken(Mockito.any(), Mockito.argThat(p -> p.getCodeVerifier() != null &&
p.getCodeVerifier().equals(pkceOauth2Service.codeVerifier())));
}
@Test
void codeVerifierParameterCanBeOverridden() throws IOException {
parameters.setGrantType(GrantType.AUTHORIZATION_CODE.toString());
String codeVerifier = "code-verifier";
parameters.setCodeVerifier(codeVerifier);
pkceOauth2Service.getToken(null, parameters);
Mockito.verify(oauth2Service, Mockito.times(1))
.getToken(Mockito.any(), Mockito.argThat(p -> p.getCodeVerifier() != null &&
p.getCodeVerifier().equals(codeVerifier)));
}
@Test
void codeVerifierParameterIsNotAddedForTokenRefresh() throws IOException {
parameters.setGrantType(GrantType.REFRESH_TOKEN.toString());
pkceOauth2Service.getToken(null, parameters);
Mockito.verify(oauth2Service, Mockito.times(1))
.getToken(Mockito.any(), Mockito.argThat(p -> p.getCodeVerifier() == null));
}
@Test
void getAuthorizationRequestUri() throws IOException {
String authorisationRequestUri = "https://authorisation.endpoint?" +
"response_type=code&state=state&redirect_uri=https%3A%2F%2Fredirect.uri";
String expectedOutput = authorisationRequestUri + "&" +
Parameters.CODE_CHALLENGE_METHOD + "=S256&" +
Parameters.CODE_CHALLENGE + "=" + pkceOauth2Service.codeChallenge();
Mockito.when(oauth2Service.getAuthorizationRequestUri(Mockito.any(), Mockito.any()))
.thenReturn(URI.create(authorisationRequestUri));
URI actual = pkceOauth2Service.getAuthorizationRequestUri(null, parameters);
Mockito.verify(oauth2Service, Mockito.times(1))
.getAuthorizationRequestUri(Mockito.any(), Mockito.any());
Assertions.assertEquals(actual.toString(), expectedOutput);
}
@Test
void getAuthorizationRequestUriWithOverriddenPkceParameters() throws IOException {
String authorisationRequestUri = "https://authorisation.endpoint?" +
"response_type=code&state=state&redirect_uri=https%3A%2F%2Fredirect.uri";
String codeChallengeMethod = "plain";
String codeChallenge = "code-challenge";
String expectedOutput = authorisationRequestUri + "&" +
Parameters.CODE_CHALLENGE_METHOD + "=" + codeChallengeMethod + "&" +
Parameters.CODE_CHALLENGE + "=" + codeChallenge;
parameters.setCodeChallengeMethod(codeChallengeMethod);
parameters.setCodeChallenge(codeChallenge);
Mockito.when(oauth2Service.getAuthorizationRequestUri(Mockito.any(), Mockito.any()))
.thenReturn(URI.create(authorisationRequestUri));
URI actual = pkceOauth2Service.getAuthorizationRequestUri(null, parameters);
Mockito.verify(oauth2Service, Mockito.times(1))
.getAuthorizationRequestUri(Mockito.any(), Mockito.any());
Assertions.assertEquals(actual.toString(), expectedOutput);
}
}
| 4,873 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
BaseDownloadServiceTest.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/test/java/de/adorsys/xs2a/adapter/impl/BaseDownloadServiceTest.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl;
import de.adorsys.xs2a.adapter.api.RequestHeaders;
import de.adorsys.xs2a.adapter.api.Response;
import de.adorsys.xs2a.adapter.api.ResponseHeaders;
import de.adorsys.xs2a.adapter.api.http.HttpClient;
import de.adorsys.xs2a.adapter.api.http.Interceptor;
import de.adorsys.xs2a.adapter.api.http.Request;
import de.adorsys.xs2a.adapter.impl.http.RequestBuilderImpl;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.*;
import java.util.HashMap;
import java.util.Map;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.*;
class BaseDownloadServiceTest {
public static final String BASE_URL = "https://base.url";
public static final String DOWNLOAD_URL = "https://base.url/download";
public static final String OCTET_STREAM = "application/octet-stream";
private BaseDownloadService service;
private final RequestHeaders headers = RequestHeaders.fromMap(new HashMap<>());
@Mock
private HttpClient httpClient;
@Mock
private Interceptor interceptor;
@Spy
private final Request.Builder requestBuilder = new RequestBuilderImpl(httpClient, null, null);
@Captor
private ArgumentCaptor<String> uriCaptor;
@Captor
private ArgumentCaptor<Map<String, String>> headersCaptor;
@BeforeEach
public void setUp() {
MockitoAnnotations.initMocks(this);
service = new BaseDownloadService(BASE_URL, httpClient, interceptor, null);
}
@Test
void download_bestCase() {
when(httpClient.get(any())).thenReturn(requestBuilder);
doReturn(dummyResponse()).when(requestBuilder).send(any(), anyList());
Response<byte[]> response = service.download(DOWNLOAD_URL, headers);
verify(httpClient, times(1)).get(uriCaptor.capture());
verify(requestBuilder, times(1)).headers(headersCaptor.capture());
assertThat(uriCaptor.getValue()).isEqualTo(DOWNLOAD_URL);
assertThat(headersCaptor.getValue()).isEqualTo(headers.toMap());
assertThat(response.getHeaders().getHeadersMap()).containsEntry(ResponseHeaders.CONTENT_TYPE, OCTET_STREAM);
}
@Test
void download_partialDownloadLink() {
when(httpClient.get(any())).thenReturn(requestBuilder);
doReturn(dummyResponse()).when(requestBuilder).send(any(), anyList());
Response<byte[]> response = service.download("/download", headers);
verify(httpClient, times(1)).get(uriCaptor.capture());
verify(requestBuilder, times(1)).headers(headersCaptor.capture());
assertThat(uriCaptor.getValue()).isEqualTo(DOWNLOAD_URL);
assertThat(headersCaptor.getValue()).isEqualTo(headers.toMap());
assertThat(response.getHeaders().getHeadersMap()).containsEntry(ResponseHeaders.CONTENT_TYPE, OCTET_STREAM);
}
@Test
void download_noProtocolLink() {
when(httpClient.get(any())).thenReturn(requestBuilder);
doReturn(dummyResponse()).when(requestBuilder).send(any(), anyList());
Response<byte[]> response = service.download("base.url/download", headers);
verify(httpClient, times(1)).get(uriCaptor.capture());
verify(requestBuilder, times(1)).headers(headersCaptor.capture());
assertThat(uriCaptor.getValue()).isEqualTo(DOWNLOAD_URL);
assertThat(headersCaptor.getValue()).isEqualTo(headers.toMap());
assertThat(response.getHeaders().getHeadersMap()).containsEntry(ResponseHeaders.CONTENT_TYPE, OCTET_STREAM);
}
private Response<byte[]> dummyResponse() {
return new Response<>(0, new byte[]{}, ResponseHeaders.fromMap(new HashMap<>()));
}
}
| 4,573 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
AbstractAdapterServiceProviderTest.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/test/java/de/adorsys/xs2a/adapter/impl/AbstractAdapterServiceProviderTest.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl;
import de.adorsys.xs2a.adapter.api.AccountInformationService;
import de.adorsys.xs2a.adapter.api.PaymentInitiationService;
import de.adorsys.xs2a.adapter.api.http.HttpClientFactory;
import de.adorsys.xs2a.adapter.api.http.Interceptor;
import de.adorsys.xs2a.adapter.api.link.LinksRewriter;
import de.adorsys.xs2a.adapter.api.model.Aspsp;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.util.Collections;
import java.util.List;
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
class AbstractAdapterServiceProviderTest {
private AbstractAdapterServiceProvider provider;
private Aspsp aspsp;
@BeforeEach
void setUp() {
provider = new AbstractAdapterServiceProvider() {
@Override
public AccountInformationService getAccountInformationService(Aspsp aspsp, HttpClientFactory httpClientFactory, LinksRewriter linksRewriter) {
return null;
}
@Override
public PaymentInitiationService getPaymentInitiationService(Aspsp aspsp, HttpClientFactory httpClientFactory, LinksRewriter linksRewriter) {
return null;
}
@Override
public String getAdapterId() {
return null;
}
};
aspsp = new Aspsp();
}
@Test
void getInterceptors_wiremockValidationDisabled_InterceptorIsNull() {
provider.wiremockValidationEnabled(false);
List<Interceptor> interceptors = provider.getInterceptors(aspsp, null);
assertThat(interceptors).isNotNull();
assertThat(interceptors).isEqualTo(Collections.emptyList());
}
@Test
void getInterceptors_wiremockValidationDisabled_InterceptorIsNotNull() {
provider.wiremockValidationEnabled(false);
List<Interceptor> interceptors = provider.getInterceptors(aspsp, builder -> null);
assertThat(interceptors).isNotNull();
assertThat(interceptors.size()).isEqualTo(1);
}
@Test
void getInterceptors_wiremockValidationEnabled_InterceptorIsNotNull_wrongAdapterId() {
provider.wiremockValidationEnabled(true);
aspsp.setAdapterId("wrong-adapter-id");
List<Interceptor> interceptors = provider.getInterceptors(aspsp, builder -> null);
assertThat(interceptors).isNotNull();
assertThat(interceptors.size()).isEqualTo(1);
}
@Test
void getInterceptors_wiremockValidationEnabled_InterceptorIsNotNull_WiremockStubInterceptor() {
provider.wiremockValidationEnabled(true);
aspsp.setAdapterId("adorsys-adapter");
List<Interceptor> interceptors = provider.getInterceptors(aspsp, builder -> null);
assertThat(interceptors).isNotNull();
assertThat(interceptors.size()).isEqualTo(2);
}
}
| 3,697 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
RequestSigningServiceTest.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/test/java/de/adorsys/xs2a/adapter/impl/signing/RequestSigningServiceTest.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl.signing;
import de.adorsys.xs2a.adapter.api.Pkcs12KeyStore;
import de.adorsys.xs2a.adapter.api.RequestHeaders;
import de.adorsys.xs2a.adapter.impl.signing.header.Digest;
import de.adorsys.xs2a.adapter.impl.signing.header.Signature;
import de.adorsys.xs2a.adapter.impl.signing.header.TppSignatureCertificate;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.security.*;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.util.HashMap;
import java.util.Map;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.*;
@ExtendWith(MockitoExtension.class)
class RequestSigningServiceTest {
private static final X509Certificate certificate = generateCertificate();
@Mock
private Pkcs12KeyStore keyStore;
@InjectMocks
private RequestSigningService service;
@Test
void buildDigest() {
Digest actual = service.buildDigest("body");
assertNotNull(actual);
assertEquals("Digest", actual.getHeaderName());
assertEquals("SHA-256=Iw2DWNyOiJC0xY3utikS7i8gNXrpKlzIYbmOaP4xrLU=", actual.getHeaderValue());
}
@Test
void buildSignature() throws KeyStoreException, UnsupportedEncodingException, CertificateException, UnrecoverableKeyException, NoSuchAlgorithmException {
Map<String, String> headers = new HashMap<>();
headers.put("header", "header");
when(keyStore.getQsealCertificate()).thenReturn(certificate);
when(keyStore.getQsealPrivateKey()).thenReturn(generatePrivateKey());
Signature actual = service.buildSignature(headers);
verify(keyStore, times(1)).getQsealCertificate();
verify(keyStore, times(1)).getQsealPrivateKey();
assertNotNull(actual);
assertEquals("Signature", actual.getHeaderName());
assertTrue(actual.getHeaderValue().contains("keyId="));
assertTrue(actual.getHeaderValue().contains("algorithm=\"SHA256withRSA\""));
}
@Test
void buildTppSignatureCertificate() throws KeyStoreException, UnsupportedEncodingException, CertificateException {
when(keyStore.getQsealCertificate()).thenReturn(certificate);
TppSignatureCertificate actual = service.buildTppSignatureCertificate();
verify(keyStore, times(1)).getQsealCertificate();
assertNotNull(actual);
assertEquals(RequestHeaders.TPP_SIGNATURE_CERTIFICATE, actual.getHeaderName());
assertTrue(actual.getHeaderValue().contains("MIIBLTCB2KADAgECAgEDMA0GCSqGSI"));
}
private static X509Certificate generateCertificate() {
X509Certificate certificate = null;
CertificateFactory cf = null;
String b64 =
"-----BEGIN CERTIFICATE-----\n" +
"MIIBLTCB2KADAgECAgEDMA0GCSqGSIb3DQEBBAUAMA0xCzAJBgNVBAMTAkNBMB4X\n" +
"DTAyMTEwNzExNTcwM1oXDTIyMTEwNzExNTcwM1owFTETMBEGA1UEAxMKRW5kIEVu\n" +
"dGl0eTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDVBDfF+uBr5s5jzzDs1njKlZNt\n" +
"h8hHzEt3ASh67Peos+QrDzgpUyFXT6fdW2h7iPf0ifjM8eW2xa+3EnPjjU5jAgMB\n" +
"AAGjGzAZMBcGA1UdIAQQMA4wBgYEVR0gADAEBgIqADANBgkqhkiG9w0BAQQFAANB\n" +
"AFo//WOboCNOCcA1fvcWW9oc4MvV8ZPvFIAbyEbgyFd4id5lGDTRbRPvvNZRvdsN\n" +
"NM2gXYr+f87NHIXc9EF3pzw=\n" +
"-----END CERTIFICATE-----";
InputStream is = new ByteArrayInputStream(b64.getBytes(StandardCharsets.UTF_8));
try {
cf = CertificateFactory.getInstance("X.509");
certificate = (X509Certificate) cf.generateCertificate(is);
} catch (CertificateException e) {
throw new RuntimeException(e);
}
return certificate;
}
private PrivateKey generatePrivateKey() throws NoSuchAlgorithmException {
KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA");
KeyPair keyPair = generator.genKeyPair();
return keyPair.getPrivate();
}
}
| 5,196 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
TppSignatureCertificateTest.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/test/java/de/adorsys/xs2a/adapter/impl/signing/header/TppSignatureCertificateTest.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl.signing.header;
import de.adorsys.xs2a.adapter.api.RequestHeaders;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
class TppSignatureCertificateTest {
private static final String PUBLIC_KEY_AS_STRING = "Lorem ipsum dolor sit amet, consectetur adipiscing elit";
@Test
void build() {
TppSignatureCertificate tppSignatureCertificate = TppSignatureCertificate.builder()
.publicKeyAsString(PUBLIC_KEY_AS_STRING)
.build();
assertThat(tppSignatureCertificate.getHeaderName()).isEqualTo(RequestHeaders.TPP_SIGNATURE_CERTIFICATE);
assertThat(tppSignatureCertificate.getHeaderValue()).isEqualTo(PUBLIC_KEY_AS_STRING);
}
}
| 1,593 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
SignatureTest.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/test/java/de/adorsys/xs2a/adapter/impl/signing/header/SignatureTest.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl.signing.header;
import de.adorsys.xs2a.adapter.api.RequestHeaders;
import de.adorsys.xs2a.adapter.api.exception.HttpRequestSigningException;
import de.adorsys.xs2a.adapter.impl.signing.algorithm.EncodingAlgorithm;
import de.adorsys.xs2a.adapter.impl.signing.algorithm.EncodingAlgorithm.EncodingService;
import de.adorsys.xs2a.adapter.impl.signing.algorithm.SigningAlgorithm;
import de.adorsys.xs2a.adapter.impl.signing.algorithm.SigningAlgorithm.SigningService;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.security.PrivateKey;
import java.util.HashMap;
import java.util.Map;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.when;
@ExtendWith(MockitoExtension.class)
class SignatureTest {
private static final String KEY_ID = "keyIdValue";
private static final Map<String, String> HEADERS_MAP = new HashMap<>();
private static final String HELLO_HEADER_NAME = "HelloHeaderName";
private static final String HELLO_HEADER_VALUE = "HelloHeaderValue";
private static final String BYE_HEADER_NAME = "ByeHeaderName";
private static final String BYE_HEADER_VALUE = "ByeHeaderValue";
private static final Charset UTF8_CHARSET = StandardCharsets.UTF_8;
private static final byte[] SIGNED_VALUE = "SignedValue".getBytes();
private static final String SIGNATURE_ATTRIBUTE_VALUE = "SignatureAttributeValue";
private static final String SIGNING_ALGORITHM_NAME = "SHA256withRSA";
private static final String EXPECTED_SIGNATURE_VALUE =
String.format("keyId=\"%s\",algorithm=\"%s\",headers=\"byeheadername helloheadername\",signature=\"%s\"",
KEY_ID, SIGNING_ALGORITHM_NAME, SIGNATURE_ATTRIBUTE_VALUE);
@Mock
private SigningAlgorithm signingAlgorithm;
@Mock
private SigningService signingService;
@Mock
private EncodingAlgorithm encodingAlgorithm;
@Mock
private EncodingService encodingService;
@Mock
private PrivateKey privateKey;
@BeforeEach
public void setup() {
HEADERS_MAP.put(HELLO_HEADER_NAME, HELLO_HEADER_VALUE);
HEADERS_MAP.put(BYE_HEADER_NAME, BYE_HEADER_VALUE);
}
@Test
void build() {
when(signingAlgorithm.getSigningService())
.thenReturn(signingService);
when(signingService.sign(Mockito.eq(privateKey), Mockito.anyString(), Mockito.eq(UTF8_CHARSET)))
.thenReturn(SIGNED_VALUE);
when(encodingAlgorithm.getEncodingService())
.thenReturn(encodingService);
when(encodingService.encode(SIGNED_VALUE))
.thenReturn(SIGNATURE_ATTRIBUTE_VALUE);
when(signingAlgorithm.getAlgorithmName())
.thenReturn(SIGNING_ALGORITHM_NAME);
Signature signature = Signature.builder()
.keyId(KEY_ID)
.headers(HEADERS_MAP)
.signingAlgorithm(signingAlgorithm)
.encodingAlgorithm(encodingAlgorithm)
.charset(UTF8_CHARSET)
.privateKey(privateKey)
.build();
assertThat(signature.getHeaderName()).isEqualTo(RequestHeaders.SIGNATURE);
assertThat(signature.getHeaderValue()).isEqualTo(EXPECTED_SIGNATURE_VALUE);
}
@Test
void build_failure_privateKeyIsMissing() {
Signature.Builder builder = Signature.builder()
.keyId(KEY_ID)
.headers(HEADERS_MAP)
.signingAlgorithm(signingAlgorithm)
.encodingAlgorithm(encodingAlgorithm)
.charset(UTF8_CHARSET);
Assertions.assertThrows(HttpRequestSigningException.class, builder::build);
}
@Test
void build_failure_keyIdIsMissing() {
Signature.Builder builder = Signature.builder()
.headers(HEADERS_MAP)
.signingAlgorithm(signingAlgorithm)
.encodingAlgorithm(encodingAlgorithm)
.charset(UTF8_CHARSET)
.privateKey(privateKey);
Assertions.assertThrows(HttpRequestSigningException.class, builder::build);
}
@Test
void build_failure_headersAreMissing() {
Signature.Builder builder = Signature.builder()
.keyId(KEY_ID)
.signingAlgorithm(signingAlgorithm)
.encodingAlgorithm(encodingAlgorithm)
.charset(UTF8_CHARSET)
.privateKey(privateKey);
Assertions.assertThrows(HttpRequestSigningException.class, builder::build);
}
@Test
void build_failure_signingAlgorithmIsMissing() {
Signature.Builder builder = Signature.builder()
.keyId(KEY_ID)
.headers(HEADERS_MAP)
.signingAlgorithm(null)
.encodingAlgorithm(encodingAlgorithm)
.charset(UTF8_CHARSET)
.privateKey(privateKey);
Assertions.assertThrows(HttpRequestSigningException.class, builder::build);
}
}
| 6,003 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
DigestTest.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/test/java/de/adorsys/xs2a/adapter/impl/signing/header/DigestTest.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl.signing.header;
import de.adorsys.xs2a.adapter.api.RequestHeaders;
import de.adorsys.xs2a.adapter.impl.signing.algorithm.EncodingAlgorithm;
import de.adorsys.xs2a.adapter.impl.signing.algorithm.EncodingAlgorithm.EncodingService;
import de.adorsys.xs2a.adapter.impl.signing.algorithm.HashingAlgorithm;
import de.adorsys.xs2a.adapter.impl.signing.algorithm.HashingAlgorithm.HashingService;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.when;
@ExtendWith(MockitoExtension.class)
class DigestTest {
private static final String REQUEST_BODY = "{\"hello\": \"world\"}";
private static final Charset UTF8_CHARSET = StandardCharsets.UTF_8;
private static final byte[] HASHED_REQUEST_BODY = REQUEST_BODY.getBytes();
private static final String HASHING_ALGORITHM_NAME = "SHA-256";
private static final String DIGEST_VALUE = "X48E9qOokqqrvdts8nOJRJN3OWDUoyWxBf7kbu9DBPE=";
private static final String EQUAL_SEPARATOR = "=";
private static final String EXPECTED_DIGEST_HEADER_VALUE = HASHING_ALGORITHM_NAME + EQUAL_SEPARATOR + DIGEST_VALUE;
@Mock
private EncodingAlgorithm encodingAlgorithm;
@Mock
private EncodingService encodingService;
@Mock
private HashingAlgorithm hashingAlgorithm;
@Mock
private HashingService hashingService;
@Test
void build() {
when(hashingAlgorithm.getHashingService())
.thenReturn(hashingService);
when(hashingService.hash(REQUEST_BODY, UTF8_CHARSET))
.thenReturn(HASHED_REQUEST_BODY);
when(encodingAlgorithm.getEncodingService())
.thenReturn(encodingService);
when(encodingService.encode(HASHED_REQUEST_BODY))
.thenReturn(DIGEST_VALUE);
when(hashingAlgorithm.getAlgorithmName())
.thenReturn(HASHING_ALGORITHM_NAME);
Digest digest = Digest.builder()
.requestBody(REQUEST_BODY)
.hashingAlgorithm(hashingAlgorithm)
.encodingAlgorithm(encodingAlgorithm)
.charset(UTF8_CHARSET)
.build();
assertThat(digest.getHeaderName()).isEqualTo(RequestHeaders.DIGEST);
assertThat(digest.getHeaderValue()).isEqualTo(EXPECTED_DIGEST_HEADER_VALUE);
}
}
| 3,370 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
Sha256WithRsaSigningServiceTest.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/test/java/de/adorsys/xs2a/adapter/impl/signing/algorithm/Sha256WithRsaSigningServiceTest.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl.signing.algorithm;
import de.adorsys.xs2a.adapter.api.exception.HttpRequestSigningException;
import de.adorsys.xs2a.adapter.impl.signing.algorithm.SigningAlgorithm.SigningService;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.security.KeyStore;
import java.security.PrivateKey;
import java.util.Properties;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertThrows;
class Sha256WithRsaSigningServiceTest {
private static final String STRING_TO_SIGN = "Lorem ipsum dolor sit amet, consectetur adipiscing elit";
private static final String EXPECTED_SIGNED_VALUE = "5161f9cea2a270d8a6f1b86b50a43c6960d4fe45030b8636680ba33963ff" +
"e76772d1c7b1c736ad32fa108946fbaab3bb20f6791117b60f11bf063d5f4fe4698f4cb3290f5a6a3b0d11f30ab61ac359516c103fc7" +
"d3e38bc6d9c9a10e2d99be111536fc2d1c86a4f75727dbb24e0be5a7ad949b74ec77c89d7f16e2a7a6b2f6a5b8e5d3f982f9e646da88" +
"4783f80ac517faa091cb6c9e38de8a37e85e95c0803517d4f848f9872f0d75301dcdf545da37408e22e985e7398e31b4949526cc034e" +
"5b97b8a9be47c79e0a1c20228dff8ea04567b1ed6575efa96972921922086d8995307255bb0ad606a2a98175854b5867f86ab17c6d36" +
"df68d97a7cd014456e3a3dad21bc519328a14d89b73eaf8868959150588c914b371b4f33e5b698844139db1f7979b7fd41bada51219e" +
"edbf021c632bca08425a4aa57784ee9d8954acb0e61b5686a3b8bf7b9af6b0527ef93c87b31e11bcd43575a10aba1763dfc526392a06" +
"da9f77d92270e27577eddcefe877b7779882331b5ddd8388331fb27810de2520c6bf78f59eeb7318efa950d76bfbaea46846fe60200d" +
"8195c2eec0c64362e7412120b927e4a7e171d1c93a808abbc705ac38cc9f7a385fc0829ab2f9213b0a91480599b7f7798c666906bbbd" +
"596c85005c259e65c29a2d67903a6b9e6526a590e35c2a5018d96783c901dbe898620f8bd835c9b2918a467ae5fc0f5e001b";
private static final Charset UTF8_CHARSET = StandardCharsets.UTF_8;
private static final String PATH_TO_RSA_TEST_CERTIFICATE_PROPERTIES = "/rsa-test-certificate.properties";
private static final Properties CERTIFICATE_PROPERTIES = readCertificateProperties();
private static final String CERTIFICATE_PATH_PROPERTY = "certificate.path";
private static final String CERTIFICATE_TYPE_PROPERTY = "certificate.type";
private static final String CERTIFICATE_PASSWORD_PROPERTY = "certificate.password";
private static final PrivateKey PRIVATE_KEY = readPrivateKey();
@Test
void sign() {
SigningService signingService = SigningAlgorithm.SHA256_WITH_RSA.getSigningService();
byte[] actualSignedValue = signingService.sign(PRIVATE_KEY, STRING_TO_SIGN, UTF8_CHARSET);
assertThat(toHex(actualSignedValue)).isEqualTo(EXPECTED_SIGNED_VALUE);
}
@Test
void sign_throwsException() {
SigningService signingService = SigningAlgorithm.SHA256_WITH_RSA.getSigningService();
assertThrows(HttpRequestSigningException.class, () -> signingService.sign(null, "data", UTF8_CHARSET));
}
private static Properties readCertificateProperties() {
Properties properties = new Properties();
try {
properties.load(getResourceAsStream(PATH_TO_RSA_TEST_CERTIFICATE_PROPERTIES));
} catch (IOException e) {
throw new RuntimeException(e);
}
return properties;
}
private static InputStream getResourceAsStream(String path) {
return Sha256WithRsaSigningServiceTest.class.getResourceAsStream(path);
}
public static PrivateKey readPrivateKey() {
try {
String certificatePassword = CERTIFICATE_PROPERTIES.getProperty(CERTIFICATE_PASSWORD_PROPERTY);
KeyStore keystore = KeyStore.getInstance(CERTIFICATE_PROPERTIES.getProperty(CERTIFICATE_TYPE_PROPERTY));
keystore.load(
getResourceAsStream(CERTIFICATE_PROPERTIES.getProperty(CERTIFICATE_PATH_PROPERTY)),
certificatePassword.toCharArray()
);
return (PrivateKey) keystore.getKey(keystore.aliases().nextElement(), certificatePassword.toCharArray());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
private String toHex(byte[] hashedValue) {
StringBuilder sb = new StringBuilder();
for (byte b : hashedValue) {
sb.append(Integer.toHexString((b & 0xFF) | 0x100), 1, 3);
}
return sb.toString();
}
}
| 5,371 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
Base64EncodingServiceTest.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/test/java/de/adorsys/xs2a/adapter/impl/signing/algorithm/Base64EncodingServiceTest.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl.signing.algorithm;
import de.adorsys.xs2a.adapter.impl.signing.algorithm.EncodingAlgorithm.EncodingService;
import org.junit.jupiter.api.Test;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import static org.assertj.core.api.Assertions.assertThat;
class Base64EncodingServiceTest {
private static final String STRING_TO_ENCODE = "Lorem ipsum dolor sit amet, consectetur adipiscing elit";
private static final String EXPECTED_ENCODED_VALUE =
"TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdA==";
private static final Charset UTF8_CHARSET = StandardCharsets.UTF_8;
@Test
void encode() {
EncodingService encodingService = EncodingAlgorithm.BASE64.getEncodingService();
String actualEncodedValue = encodingService.encode(STRING_TO_ENCODE.getBytes(UTF8_CHARSET));
assertThat(actualEncodedValue).isEqualTo(EXPECTED_ENCODED_VALUE);
}
}
| 1,813 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
Sha256HashingServiceTest.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/test/java/de/adorsys/xs2a/adapter/impl/signing/algorithm/Sha256HashingServiceTest.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl.signing.algorithm;
import de.adorsys.xs2a.adapter.impl.signing.algorithm.HashingAlgorithm.HashingService;
import org.junit.jupiter.api.Test;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import static org.assertj.core.api.Assertions.assertThat;
class Sha256HashingServiceTest {
private static final String STRING_TO_HASH = "Lorem ipsum dolor sit amet, consectetur adipiscing elit";
private static final String EXPECTED_HASHED_VALUE =
"07fe4d4a25718241af145a93f890eb5469052e251d199d173bd3bd50c3bb4da2";
private static final Charset UTF8_CHARSET = StandardCharsets.UTF_8;
@Test
void hash() {
HashingService hashingService = HashingAlgorithm.SHA256.getHashingService();
byte[] actualHashedValue = hashingService.hash(STRING_TO_HASH, UTF8_CHARSET);
assertThat(toHex(actualHashedValue)).isEqualTo(EXPECTED_HASHED_VALUE);
}
private String toHex(byte[] hashedValue) {
StringBuilder sb = new StringBuilder();
for (byte b : hashedValue) {
sb.append(Integer.toHexString((b & 0xFF) | 0x100), 1, 3);
}
return sb.toString();
}
}
| 2,030 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
Sha512HashingServiceTest.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/test/java/de/adorsys/xs2a/adapter/impl/signing/algorithm/Sha512HashingServiceTest.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl.signing.algorithm;
import org.junit.jupiter.api.Test;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import static org.assertj.core.api.Assertions.assertThat;
class Sha512HashingServiceTest {
private static final String STRING_TO_HASH = "Lorem ipsum dolor sit amet, consectetur adipiscing elit";
private static final String EXPECTED_HASHED_VALUE = "d3b3d69ccc163089f91d42ebef0f01dd70ec40de" +
"b76a9da5ba63ef5b39601b41a34b04f8236ce9e59a150241716a5e2da9f1bdcc2734d4d7fcd8e69df36022f0";
private static final Charset UTF8_CHARSET = StandardCharsets.UTF_8;
@Test
void hash() {
HashingAlgorithm.HashingService hashingService = HashingAlgorithm.SHA512.getHashingService();
byte[] actualHashedValue = hashingService.hash(STRING_TO_HASH, UTF8_CHARSET);
assertThat(toHex(actualHashedValue)).isEqualTo(EXPECTED_HASHED_VALUE);
}
private String toHex(byte[] hashedValue) {
StringBuilder sb = new StringBuilder();
for (byte b : hashedValue) {
sb.append(Integer.toHexString((b & 0xFF) | 0x100), 1, 3);
}
return sb.toString();
}
}
| 2,029 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
ApacheUriBuilderTest.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/test/java/de/adorsys/xs2a/adapter/impl/http/ApacheUriBuilderTest.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl.http;
import org.junit.jupiter.api.Test;
import java.net.URI;
import static org.assertj.core.api.Assertions.assertThat;
class ApacheUriBuilderTest {
public static final URI baseUriWithQueryParam = URI.create("https://base.uri?param=param");
private ApacheUriBuilder builder = new ApacheUriBuilder(baseUriWithQueryParam);
@Test
void renameQueryParam_newParameter() {
UriBuilder actual = builder.renameQueryParam("param", "another");
assertThat(actual.build()).hasToString("https://base.uri?another=param");
}
@Test
void renameQueryParam_sameParameter() {
UriBuilder actual = builder.renameQueryParam("another", "param");
assertThat(actual.build()).isEqualTo(baseUriWithQueryParam);
}
@Test
void queryParametersAreEncoded() {
URI uri = new ApacheUriBuilder(URI.create("http://example.com"))
.queryParam("uri", "https://acme.com?foo=bar&baz=asdf")
.build();
assertThat(uri).hasToString("http://example.com?uri=https%3A%2F%2Facme.com%3Ffoo%3Dbar%26baz%3Dasdf");
}
}
| 1,955 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
JsonMapperTest.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/test/java/de/adorsys/xs2a/adapter/impl/http/JsonMapperTest.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl.http;
import de.adorsys.xs2a.adapter.api.model.Aspsp;
import org.junit.jupiter.api.Test;
import java.io.ByteArrayInputStream;
import java.io.UncheckedIOException;
import static org.junit.jupiter.api.Assertions.assertThrows;
class JsonMapperTest {
JsonMapper mapper = new JacksonObjectMapper();
@Test
void writeValueAsString_throwsException() {
ByteArrayInputStream value = new ByteArrayInputStream(new byte[]{});
assertThrows(UncheckedIOException.class, () -> mapper.writeValueAsString(value));
}
@Test
void readValue_string_throwsException() {
assertThrows(UncheckedIOException.class, () -> mapper.readValue("string", Aspsp.class));
}
@Test
void readValue_inputStream_throwsException() {
ByteArrayInputStream inputStream = new ByteArrayInputStream(new byte[]{});
assertThrows(UncheckedIOException.class, () -> mapper.readValue(inputStream, Aspsp.class));
}
}
| 1,815 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
StringUriTest.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/test/java/de/adorsys/xs2a/adapter/impl/http/StringUriTest.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl.http;
import org.junit.jupiter.api.Test;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.time.LocalDate;
import java.util.Map;
import static java.util.Collections.singletonMap;
import static org.assertj.core.api.Assertions.assertThat;
class StringUriTest {
@Test
void fromElements() {
String uri = StringUri.fromElements("/a", "b/", "/c/");
assertThat(uri).isEqualTo("a/b/c");
uri = StringUri.fromElements("/d/", "e", "/f/", "g/");
assertThat(uri).isEqualTo("d/e/f/g");
}
@Test
void withQueryIgnoresParametersWithNullValues() {
assertThat(StringUri.withQuery("http://example.com", singletonMap("q", null)))
.isEqualTo("http://example.com");
}
@Test
void withQueryCallsToStringOnValues() {
assertThat(StringUri.withQuery("http://example.com", singletonMap("q", LocalDate.of(2012, 12, 21))))
.isEqualTo("http://example.com?q=2012-12-21");
}
@Test
void getQueryParamsFromUriWithoutParams() {
assertThat(StringUri.getQueryParamsFromUri("http://example.com"))
.isEmpty();
}
@Test
void getQueryParamsFromUriWithOneParam() {
String key = "q";
String value = "2012-12-21";
String uri = String.format("http://example.com?%s=%s", key, value);
Map<String, String> params = StringUri.getQueryParamsFromUri(uri);
assertThat(params).hasSize(1)
.containsEntry(key, value);
}
@Test
void getQueryParamsFromUriWithMoreThenOneParam() {
String key1 = "q";
String value1 = "2012-12-21";
String key2 = "k";
String value2 = "someKey";
String key3 = "zz";
String value3 = "someKeyZZ";
String uri = String.format("http://example.com?%s=%s&%s=%s&%s=%s",
key1, value1, key2, value2, key3, value3);
Map<String, String> params = StringUri.getQueryParamsFromUri(uri);
assertThat(params).hasSize(3)
.containsEntry(key1, value1)
.containsEntry(key2, value2)
.containsEntry(key3, value3);
}
@Test
void getQueryParamsFromUriWithEqualSignInsideParamValue() {
String key = "q";
String value = "2012=12=21";
String uri = String.format("http://example.com?%s=%s", key, value);
Map<String, String> params = StringUri.getQueryParamsFromUri(uri);
assertThat(params).hasSize(1)
.containsEntry(key, value);
}
@Test
void isUriStartsWithSlash() {
String uri = "/some/uri";
assertThat(StringUri.isUri(uri)).isTrue();
}
@Test
void isUriStartsWithVersion() {
String uri = "v2/some/uri";
assertThat(StringUri.isUri(uri)).isTrue();
}
@Test
void isUriDoesNotStartWithVersionAndSlash() {
String uri = "example.com";
assertThat(StringUri.isUri(uri)).isFalse();
}
@Test
void isUriStartsWithProtocol() {
String uri = "http://example.com";
assertThat(StringUri.isUri(uri)).isFalse();
}
@Test
void containsProtocol() {
String uriTemplate = "%s://example.com";
assertThat(StringUri.containsProtocol(String.format(uriTemplate, "https"))).isTrue();
assertThat(StringUri.containsProtocol(String.format(uriTemplate, "http"))).isTrue();
assertThat(StringUri.containsProtocol(String.format(uriTemplate, "ftp"))).isTrue();
assertThat(StringUri.containsProtocol(String.format(uriTemplate, "anyProtocol"))).isTrue();
}
@Test
void containsProtocolWithoutProtocol() {
String uri = "www.example.com";
assertThat(StringUri.containsProtocol(uri)).isFalse();
}
@Test
void decode() throws UnsupportedEncodingException {
String uri = "http://example.com/path?param1=value1¶m2=value2";
String actual = StringUri.decode(URLEncoder.encode(uri, StandardCharsets.UTF_8.name()));
assertThat(actual).isEqualTo(uri);
}
@Test
void containsQueryParam() {
String uri = "http://example.com/path?param1=value1¶m2=value2";
assertThat(StringUri.containsQueryParam(uri, "param1")).isTrue();
assertThat(StringUri.containsQueryParam(uri, "param2")).isTrue();
assertThat(StringUri.containsQueryParam(uri, "param3")).isFalse();
}
@Test
void appendQueryParam() {
String uri1 = "http://example.com/path?param1=value1¶m2=value2";
String uri2 = "http://example.com/path";
String uri3 = "http://example.com/path?param=";
String actual1 = StringUri.appendQueryParam(uri1, "param3", "value3");
Map<String, String> params1 = StringUri.getQueryParamsFromUri(actual1);
assertThat(params1).hasSize(3)
.containsEntry("param1", "value1")
.containsEntry("param2", "value2")
.containsEntry("param3", "value3");
String actual2 = StringUri.appendQueryParam(uri1, "param2", "value2");
Map<String, String> params2 = StringUri.getQueryParamsFromUri(actual2);
assertThat(params2).hasSize(2)
.containsEntry("param1", "value1")
.containsEntry("param2", "value2");
String actual3 = StringUri.appendQueryParam(uri1, "param2", "value3");
Map<String, String> params3 = StringUri.getQueryParamsFromUri(actual3);
assertThat(params3).hasSize(2)
.containsEntry("param1", "value1")
.containsEntry("param2", "value3");
String actual4 = StringUri.appendQueryParam(uri2, "param", "value");
Map<String, String> params4 = StringUri.getQueryParamsFromUri(actual4);
assertThat(params4).hasSize(1)
.containsEntry("param", "value");
String actual5 = StringUri.appendQueryParam(uri3, "param", "value");
Map<String, String> params5 = StringUri.getQueryParamsFromUri(actual5);
assertThat(params5).hasSize(1)
.containsEntry("param", "value");
}
@Test
void removeAllQueryParams() {
String uri1 = "http://example.com/path?param1=value1¶m2=value2";
String uri2 = "http://example.com/path";
assertThat(StringUri.removeAllQueryParams(uri1)).isEqualTo("http://example.com/path");
assertThat(StringUri.removeAllQueryParams(uri2)).isEqualTo("http://example.com/path");
}
@Test
void getVersion() {
String uri1 = "http://example.com/path/v1";
assertThat(StringUri.getVersion(uri1)).contains("v1");
String uri2 = "http://example.com/path/v1/";
assertThat(StringUri.getVersion(uri2)).contains("v1");
String uri3 = "http://example.com/path/";
assertThat(StringUri.getVersion(uri3)).isEmpty();
String uri4 = "http://example.com/pav1th/";
assertThat(StringUri.getVersion(uri4)).isEmpty();
}
@Test
void copyQueryParams() {
String source1 = "http://example.com/path";
String target1 = "http://example.com/another/path";
assertThat(StringUri.copyQueryParams(source1, target1))
.isEqualTo("http://example.com/another/path");
String source2 = "http://example.com/path?p1=v1&p2=v2";
String target2 = "http://example.com/another/path";
assertThat(StringUri.copyQueryParams(source2, target2))
.isEqualTo("http://example.com/another/path?p1=v1&p2=v2");
String source3 = "http://example.com/path?p1=v1&p2=v2";
String target3 = "http://example.com/another/path?p3=v3";
assertThat(StringUri.copyQueryParams(source3, target3))
.isEqualTo("http://example.com/another/path?p3=v3&p1=v1&p2=v2");
}
}
| 8,614 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
Psd2DateTimeDeserializerTest.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/test/java/de/adorsys/xs2a/adapter/impl/http/Psd2DateTimeDeserializerTest.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl.http;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.util.JsonParserDelegate;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.time.OffsetDateTime;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
class Psd2DateTimeDeserializerTest {
Psd2DateTimeDeserializer deserializer = new Psd2DateTimeDeserializer();
@Test
void deserialize() throws IOException {
OffsetDateTime time = deserializer.deserialize(new JsonParserDelegate(mock(JsonParser.class)), null);
assertThat(time).isNull();
}
}
| 1,499 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
ApacheHttpClientFactoryTest.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/test/java/de/adorsys/xs2a/adapter/impl/http/ApacheHttpClientFactoryTest.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl.http;
import de.adorsys.xs2a.adapter.api.Pkcs12KeyStore;
import de.adorsys.xs2a.adapter.api.http.HttpClient;
import de.adorsys.xs2a.adapter.api.http.HttpClientConfig;
import org.apache.http.impl.client.HttpClientBuilder;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import javax.net.ssl.SSLContext;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.security.KeyManagementException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.UnrecoverableEntryException;
import java.security.cert.CertificateException;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
class ApacheHttpClientFactoryTest {
private ApacheHttpClientFactory factory;
private Pkcs12KeyStore pkcs12KeyStore;
@BeforeEach
public void setUp() throws Exception {
pkcs12KeyStore = mock(Pkcs12KeyStore.class);
HttpClientConfig httpClientConfig = mock(HttpClientConfig.class);
when(pkcs12KeyStore.getSslContext(any()))
.thenReturn(SSLContext.getDefault());
when(httpClientConfig.getKeyStore()).thenReturn(pkcs12KeyStore);
factory = new ApacheHttpClientFactory(HttpClientBuilder.create(), httpClientConfig);
}
@Test
void getHttpClientCachesClientsByAdapterId() {
HttpClient httpClient = factory.getHttpClient("test-adapter");
HttpClient httpClient2 = factory.getHttpClient("test-adapter");
assertThat(httpClient).isSameAs(httpClient2);
HttpClient httpClient3 = factory.getHttpClient("another-test-adapter");
assertThat(httpClient).isNotSameAs(httpClient3);
}
@Test
void getHttpClient_throwsException() throws CertificateException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException, UnrecoverableEntryException, IOException {
when(pkcs12KeyStore.getSslContext(any())).thenThrow(new IOException());
assertThrows(UncheckedIOException.class, () -> factory.getHttpClient("test-adapter"));
}
}
| 3,110 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
Xs2AHttpLogSanitizerTest.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/test/java/de/adorsys/xs2a/adapter/impl/http/Xs2AHttpLogSanitizerTest.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl.http;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import de.adorsys.xs2a.adapter.api.http.ContentType;
import de.adorsys.xs2a.adapter.api.http.HttpLogSanitizer;
import de.adorsys.xs2a.adapter.api.model.ConsentsResponse201;
import org.apache.http.entity.StringEntity;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.assertj.core.api.Assertions.assertThat;
class Xs2AHttpLogSanitizerTest {
public static final String REPLACEMENT = "******";
private final List<String> whitelist = Arrays.asList("recurringIndicator", "validUntil", "frequencyPerDay", "combinedServiceIndicator");
private final HttpLogSanitizer anonymizer = new Xs2aHttpLogSanitizer(whitelist);
@Test
void sanitize() {
String data = "https://xs2a-sndbx.consorsbank.de/v1/consents/a9b2d4e9-91da-4a1b-bf9b-d7619aa67462/authorisations";
String sanitizedString = anonymizer.sanitize(data);
assertThat(sanitizedString).isEqualTo("https://xs2a-sndbx.consorsbank.de/v1/consents/******/authorisations");
data = "https://simulator-xs2a.db.com/ais/DE/SB-DB/v1/consents/3e91db48-6d2e-44d3-b281-3a650d0292c3/authorisations/e15b3267-572e-400b-b87a-fb242eb52bb5";
sanitizedString = anonymizer.sanitize(data);
assertThat(sanitizedString).isEqualTo("https://simulator-xs2a.db.com/ais/DE/SB-DB/v1/consents/******/authorisations/******");
data = "https://www.volksbanking.de/services_xs2a/v1/payments/pain.001-sepa-credit-transfers/4692565214260020253PSDDE-BAFIN-115162PA1718LJ/authorisations";
sanitizedString = anonymizer.sanitize(data);
assertThat(sanitizedString).isEqualTo("https://www.volksbanking.de/services_xs2a/v1/payments/pain.001-sepa-credit-transfers/******/authorisations");
data = "https://www.volksbanking.de/services_xs2a/v1/payments/pain.001-sepa-credit-transfers/4692565214260020253PSDDE-BAFIN-115162PA1718LJ/authorisations/8593075214260020254PSDDE-BAFIN-115162AU1718LJ";
sanitizedString = anonymizer.sanitize(data);
assertThat(sanitizedString).isEqualTo("https://www.volksbanking.de/services_xs2a/v1/payments/pain.001-sepa-credit-transfers/******/authorisations/******");
data = "https://xs2a-api.comdirect.de/berlingroup/v1/payments/sepa-credit-transfers/4692565214260020253PSDDE-BAFIN-115162PA1718LJ/authorisations/8593075214260020254PSDDE-BAFIN-115162AU1718LJ";
sanitizedString = anonymizer.sanitize(data);
assertThat(sanitizedString).isEqualTo("https://xs2a-api.comdirect.de/berlingroup/v1/payments/sepa-credit-transfers/******/authorisations/******");
data = "https://xs2a-api.comdirect.de/berlingroup/v1/payments/instant-sepa-credit-transfers/4692565214260020253PSDDE-BAFIN-115162PA1718LJ/authorisations/8593075214260020254PSDDE-BAFIN-115162AU1718LJ";
sanitizedString = anonymizer.sanitize(data);
assertThat(sanitizedString).isEqualTo("https://xs2a-api.comdirect.de/berlingroup/v1/payments/instant-sepa-credit-transfers/******/authorisations/******");
data = "https://xs2a-api.comdirect.de/berlingroup/v1/payments/pain.001-instant-sepa-credit-transfers/4692565214260020253PSDDE-BAFIN-115162PA1718LJ/authorisations/8593075214260020254PSDDE-BAFIN-115162AU1718LJ";
sanitizedString = anonymizer.sanitize(data);
assertThat(sanitizedString).isEqualTo("https://xs2a-api.comdirect.de/berlingroup/v1/payments/pain.001-instant-sepa-credit-transfers/******/authorisations/******");
data = "https://xs2a-api.comdirect.de/berlingroup/v1/payments/cross-border-credit-transfers/4692565214260020253PSDDE-BAFIN-115162PA1718LJ/authorisations/8593075214260020254PSDDE-BAFIN-115162AU1718LJ";
sanitizedString = anonymizer.sanitize(data);
assertThat(sanitizedString).isEqualTo("https://xs2a-api.comdirect.de/berlingroup/v1/payments/cross-border-credit-transfers/******/authorisations/******");
data = "https://xs2a-api.comdirect.de/berlingroup/v1/payments/pain.001-cross-border-credit-transfers/4692565214260020253PSDDE-BAFIN-115162PA1718LJ/authorisations/8593075214260020254PSDDE-BAFIN-115162AU1718LJ";
sanitizedString = anonymizer.sanitize(data);
assertThat(sanitizedString).isEqualTo("https://xs2a-api.comdirect.de/berlingroup/v1/payments/pain.001-cross-border-credit-transfers/******/authorisations/******");
data = "https://xs2a-api.comdirect.de/berlingroup/v1/payments/target-2-payments/4692565214260020253PSDDE-BAFIN-115162PA1718LJ/authorisations/8593075214260020254PSDDE-BAFIN-115162AU1718LJ";
sanitizedString = anonymizer.sanitize(data);
assertThat(sanitizedString).isEqualTo("https://xs2a-api.comdirect.de/berlingroup/v1/payments/target-2-payments/******/authorisations/******");
data = "https://xs2a-api.comdirect.de/berlingroup/v1/payments/pain.001-target-2-payments/4692565214260020253PSDDE-BAFIN-115162PA1718LJ/authorisations/8593075214260020254PSDDE-BAFIN-115162AU1718LJ";
sanitizedString = anonymizer.sanitize(data);
assertThat(sanitizedString).isEqualTo("https://xs2a-api.comdirect.de/berlingroup/v1/payments/pain.001-target-2-payments/******/authorisations/******");
}
@Test
void sanitizeSensitiveHeaders() {
List<String> headers = Arrays.asList("Authorization", "PSU-ID", "PSU-Corporate-ID", "Consent-ID", "X-GTW-IBAN",
"Location", "location", "X-dynatrace-Origin-URL");
for (String header : headers) {
String sanitizedHeader = anonymizer.sanitizeHeader(header, "1234567");
assertThat(sanitizedHeader).isEqualTo(REPLACEMENT);
}
}
@Test
void sanitizeGeneralHeader() {
List<String> headers = Arrays.asList("Content-type", "Accept", "Correlation-ID");
for (String header : headers) {
String sanitizedHeader = anonymizer.sanitizeHeader(header, "1234567");
assertThat(sanitizedHeader).isEqualTo("1234567");
}
}
@Test
void sanitizeResponseBody() throws IOException {
String json = "{" +
"\"consentStatus\":\"received\"," +
"\"consentId\":\"40b01787-a5eb-48c0-bc38-050b8e657a88\"," +
"\"_links\":{" +
"\"scaStatus\":{" +
"\"href\":\"https://simulator-xs2a.db.com/ais/DE/SB-DB/v1/consents/40b01787-a5eb-48c0-bc38-050b8e657a88/authorisations/9625c345-c41a-4c69-b9ea-824fa2c69c3a\"" +
"}," +
"\"startAuthorisationWithEncryptedPsuAuthentication\":{" +
"\"href\":\"https://simulator-xs2a.db.com/ais/DE/SB-DB/v1/consents/40b01787-a5eb-48c0-bc38-050b8e657a88/authorisations/9625c345-c41a-4c69-b9ea-824fa2c69c3a\"" +
"}," +
"\"self\":{" +
"\"href\":\"https://simulator-xs2a.db.com/ais/DE/SB-DB/v1/consents/40b01787-a5eb-48c0-bc38-050b8e657a88\"" +
"}," +
"\"aspspCertificates\":{" +
"\"href\":\"https://simulator-xs2a.db.com/DE/SB-DB/aspsp-certificates/\"" +
"}," +
"\"status\":{" +
"\"href\":\"https://simulator-xs2a.db.com/ais/DE/SB-DB/v1/consents/40b01787-a5eb-48c0-bc38-050b8e657a88/status\"" +
"}" +
" }" +
"}";
String expectedJson = "{" +
"\"consentStatus\":\"******\"," +
"\"consentId\":\"******\"," +
"\"_links\":{" +
"\"scaStatus\":{" +
"\"href\":\"******\"" +
"}," +
"\"startAuthorisationWithEncryptedPsuAuthentication\":{" +
"\"href\":\"******\"" +
"}," +
"\"self\":{" +
"\"href\":\"******\"" +
"}," +
"\"aspspCertificates\":{" +
"\"href\":\"******\"" +
"}," +
"\"status\":{" +
"\"href\":\"******\"" +
"}" +
"}" +
"}";
ConsentsResponse201 consentCreationResponse = new ObjectMapper().readValue(json, ConsentsResponse201.class);
String body = anonymizer.sanitizeResponseBody(consentCreationResponse, ContentType.APPLICATION_JSON);
assertThat(body).isEqualTo(expectedJson);
}
@Test
void sanitizeResponseBodyNotJsonContentType() {
String body = anonymizer.sanitizeResponseBody(new Object(), "application/xml");
assertThat(body).isEqualTo(REPLACEMENT);
}
@Test
void sanitizeResponseBodyWithSerializationError() {
String body = anonymizer.sanitizeResponseBody(Arrays.asList("abc", "123"), "application/json");
assertThat(body).isEqualTo("[\"" + REPLACEMENT + "\",\"" + REPLACEMENT + "\"]");
}
@Test
void sanitizeResponseBodyAsString() throws JsonProcessingException {
ObjectMapper mapper = new ObjectMapper();
Map<String, String> map = new HashMap<>();
map.put("key", "value");
String body = anonymizer.sanitizeResponseBody(mapper.writeValueAsString(map), "application/json");
assertThat(body).isEqualTo("{\"key\":\"" + REPLACEMENT + "\"}");
}
@Test
void sanitizeRequestBody() throws UnsupportedEncodingException {
String json = "{" +
"\"access\":{" +
"\"balances\":[" +
"{" +
"\"iban\":\"\"," +
"\"currency\":\"EUR\"" +
"}" +
"]," +
"\"transactions\":[" +
"{" +
"\"iban\":\"DE82500105176963379138\"," +
"\"currency\":\"EUR\"" +
"}" +
"]," +
"\"accounts\":[" +
"{" +
"\"iban\":\"DE82500105176963379138\"," +
"\"currency\":\"EUR\"" +
"}" +
"]" +
"}" +
"}";
String expectedSanitizedJson = "{" +
"\"access\":{" +
"\"balances\":[" +
"{" +
"\"iban\":\"******\"," +
"\"currency\":\"******\"" +
"}" +
"]," +
"\"transactions\":[" +
"{" +
"\"iban\":\"******\"," +
"\"currency\":\"******\"" +
"}" +
"]," +
"\"accounts\":[" +
"{" +
"\"iban\":\"******\"," +
"\"currency\":\"******\"" +
"}" +
"]" +
"}" +
"}";
String actualSanitizedJson = anonymizer.sanitizeRequestBody(new StringEntity(json), "application/json");
assertThat(actualSanitizedJson).isEqualTo(expectedSanitizedJson);
}
@Test
void sanitizeRequestBodyWithNonSanitizedProperties() throws UnsupportedEncodingException {
String json = "{" +
"\"access\":{" +
"\"balances\":[" +
"{" +
"\"iban\":\"\"," +
"\"currency\":\"EUR\"" +
"}" +
"]," +
"\"transactions\":[" +
"{" +
"\"iban\":\"DE82500105176963379138\"," +
"\"currency\":\"EUR\"" +
"}" +
"]," +
"\"accounts\":[" +
"{" +
"\"iban\":\"DE82500105176963379138\"," +
"\"currency\":\"EUR\"" +
"}" +
"]" +
"}," +
"\"combinedServiceIndicator\":\"false\"," +
"\"recurringIndicator\":\"true\"," +
"\"validUntil\":\"01-01-2020\"," +
"\"frequencyPerDay\":\"4\"" +
"}";
String expectedSanitizedJson = "{" +
"\"access\":{" +
"\"balances\":[" +
"{" +
"\"iban\":\"******\"," +
"\"currency\":\"******\"" +
"}" +
"]," +
"\"transactions\":[" +
"{" +
"\"iban\":\"******\"," +
"\"currency\":\"******\"" +
"}" +
"]," +
"\"accounts\":[" +
"{" +
"\"iban\":\"******\"," +
"\"currency\":\"******\"" +
"}" +
"]" +
"}," +
"\"combinedServiceIndicator\":\"false\"," +
"\"recurringIndicator\":\"true\"," +
"\"validUntil\":\"01-01-2020\"," +
"\"frequencyPerDay\":\"4\"" +
"}";
String actualSanitizedJson = anonymizer.sanitizeRequestBody(new StringEntity(json), "application/json");
assertThat(actualSanitizedJson).isEqualTo(expectedSanitizedJson);
}
@Test
void sanitizeRequestBodyNotJsonContentType() throws UnsupportedEncodingException {
String actualSanitizedJson = anonymizer.sanitizeRequestBody(new StringEntity("<xml>"), "application/xml");
assertThat(actualSanitizedJson).isEqualTo(REPLACEMENT);
}
@Test
void sanitizeRequestBodyEmptyBody() throws UnsupportedEncodingException {
String actualSanitizedJson = anonymizer.sanitizeRequestBody(new StringEntity(""), "application/json");
assertThat(actualSanitizedJson).isEqualTo(REPLACEMENT);
}
@Test
void sanitizeErrorBody_DKBCase() {
String accountId = "74d110c6-11aa-22bb-33cc-b6373a561977";
//language=JSON
String errorResponse = "{\n" +
" \"tppMessages\": [\n" +
" {\n" +
" \"category\": \"ERROR\",\n" +
" \"code\": \"SERVICE_BLOCKED\",\n" +
" \"path\": \"/v1/accounts/%s/transactions\",\n" +
" \"text\": \"Insufficient consent for transactions of accountId %s.\"\n" +
" }\n" +
" ],\n" +
" \"_links\": {}\n" +
"}";
String notSanitized = String.format(errorResponse, accountId, accountId);
String actual = anonymizer.sanitize(notSanitized);
assertThat(actual).doesNotContain(accountId);
}
@Test
void sanitizeUrl_commerzbankCase() {
String accountId = "400e565d-11aa-22bb-33cc-b1b9bc1e6da5";
String url = "https://psd2.api.commerzbank.com/berlingroup/.well-known/openid-configuration?authorizationId=%s";
String notSanitized = String.format(url, accountId);
String actual = anonymizer.sanitize(notSanitized);
assertThat(actual).doesNotContain(accountId);
}
}
| 15,274 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
UriBuilderTest.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/test/java/de/adorsys/xs2a/adapter/impl/http/UriBuilderTest.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl.http;
import org.junit.jupiter.api.Test;
import java.net.URI;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
class UriBuilderTest {
@Test
void queryParamIsNotAddedIfValueIsNull() {
URI uri = UriBuilder.fromUri("http://acme.com/")
.queryParam("q", null)
.build();
assertEquals("http://acme.com/", uri.toString());
}
@Test
void stringUriMustBeValid() {
assertThrows(IllegalArgumentException.class, () -> UriBuilder.fromUri("http://acme.com/?q=two words"));
}
@Test
void whitespaceInQueryIsUrlFormEncoded() {
URI uri = UriBuilder.fromUri("http://acme.com/")
.queryParam("q", "two words")
.build();
assertEquals("q=two+words", uri.getQuery());
assertEquals("q=two+words", uri.getRawQuery());
}
}
| 1,773 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
ResponseHandlersTest.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/test/java/de/adorsys/xs2a/adapter/impl/http/ResponseHandlersTest.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl.http;
import de.adorsys.xs2a.adapter.api.ResponseHeaders;
import de.adorsys.xs2a.adapter.api.exception.ErrorResponseException;
import de.adorsys.xs2a.adapter.api.exception.OAuthException;
import de.adorsys.xs2a.adapter.api.http.HttpClient;
import de.adorsys.xs2a.adapter.api.model.*;
import org.junit.jupiter.api.Test;
import java.io.ByteArrayInputStream;
import java.time.LocalDate;
import java.util.HashMap;
import java.util.Map;
import static java.util.Collections.singletonMap;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.fail;
class ResponseHandlersTest {
private static final String CONTENT_TYPE_HEADER = "Content-Type";
private static final String SCA_OAUTH_URL = "https://example.com";
private final ResponseHandlers responseHandlers = new ResponseHandlers();
@Test
void jsonResponseHandlerParsesOnSuccessfulResponse() {
Amount amount = responseHandlers.jsonResponseHandler(Amount.class).apply(200,
new ByteArrayInputStream("{\"amount\":\"10\", \"currency\":\"EUR\"}".getBytes()),
ResponseHeaders.emptyResponseHeaders());
assertThat(amount.getAmount()).isEqualTo("10");
assertThat(amount.getCurrency()).isEqualTo("EUR");
}
@Test
void jsonResponseHandlerThrowsOnErrorResponseAndExceptionMessageContainsResponseBody() {
HttpClient.ResponseHandler<Amount> jsonResponseHandler = responseHandlers.jsonResponseHandler(Amount.class);
ByteArrayInputStream responseBody = new ByteArrayInputStream("{}".getBytes());
ResponseHeaders responseHeaders = ResponseHeaders.emptyResponseHeaders();
try {
jsonResponseHandler.apply(400, responseBody, responseHeaders);
fail();
} catch (ErrorResponseException e) {
assertThat(e.getMessage()).isEqualTo("{}");
}
}
@Test
void jsonResponseHandlerThrowsErrorOnUnsupportedFormatBody() {
HttpClient.ResponseHandler<Amount> jsonResponseHandler = responseHandlers.jsonResponseHandler(Amount.class);
ByteArrayInputStream responseBody = new ByteArrayInputStream("<response>".getBytes());
ResponseHeaders responseHeaders = ResponseHeaders.emptyResponseHeaders();
try {
jsonResponseHandler.apply(400, responseBody, responseHeaders);
fail();
} catch (ErrorResponseException e) {
assertThat(e.getMessage()).isEqualTo("<response>");
}
}
@Test
void jsonResponseHandlerThrowsErrorOnUnsupportedContentType() {
Map<String, String> headers = new HashMap<>();
headers.put(CONTENT_TYPE_HEADER, "application/xml");
HttpClient.ResponseHandler<Amount> jsonResponseHandler = responseHandlers.jsonResponseHandler(Amount.class);
ByteArrayInputStream responseBody = new ByteArrayInputStream("<response>".getBytes());
ResponseHeaders responseHeaders = ResponseHeaders.fromMap(headers);
try {
jsonResponseHandler.apply(400, responseBody, responseHeaders);
fail();
} catch (ErrorResponseException e) {
assertThat(e.getMessage()).isEqualTo("<response>");
}
}
@Test
void jsonResponseHandlerThrowsErrorInJsonFormat() {
Map<String, String> headers = new HashMap<>();
headers.put(CONTENT_TYPE_HEADER, "application/json");
HttpClient.ResponseHandler<Amount> jsonResponseHandler = responseHandlers.jsonResponseHandler(Amount.class);
ByteArrayInputStream responseBody = new ByteArrayInputStream("{}".getBytes());
ResponseHeaders responseHeaders = ResponseHeaders.fromMap(headers);
try {
jsonResponseHandler.apply(400, responseBody, responseHeaders);
fail();
} catch (ErrorResponseException e) {
assertThat(e.getMessage()).isEqualTo("{}");
}
}
@Test
void stringResponseHandlerReturnsResponseBodyAsStringOnSuccessfulResponse() {
String response = responseHandlers.stringResponseHandler().apply(200,
new ByteArrayInputStream("<response>".getBytes()),
ResponseHeaders.emptyResponseHeaders());
assertThat(response).isEqualTo("<response>");
}
@Test
void stringResponseHandlerThrowsOnErrorResponse() {
HttpClient.ResponseHandler<String> stringResponseHandler = responseHandlers.stringResponseHandler();
ByteArrayInputStream responseBody = new ByteArrayInputStream("{}".getBytes());
ResponseHeaders responseHeaders = ResponseHeaders.emptyResponseHeaders();
try {
stringResponseHandler.apply(400, responseBody, responseHeaders);
fail();
} catch (ErrorResponseException e) {
assertThat(e.getMessage()).isEqualTo("{}");
}
}
@Test
void byteArrayResponseHandlerThrowsOnErrorResponse() {
HttpClient.ResponseHandler<byte[]> responseHandler = responseHandlers.byteArrayResponseHandler();
ByteArrayInputStream responseBody = new ByteArrayInputStream("{}".getBytes());
ResponseHeaders responseHeaders = ResponseHeaders.emptyResponseHeaders();
try {
responseHandler.apply(400, responseBody, responseHeaders);
fail();
} catch (ErrorResponseException e) {
assertThat(e.getMessage()).isEqualTo("{}");
}
}
@Test
void byteArrayResponseHandlerReturnsResponseBodyAsByteArrayOnSuccessfulResponse() {
byte[] response = responseHandlers.byteArrayResponseHandler().apply(200,
new ByteArrayInputStream("<response>".getBytes()),
ResponseHeaders.emptyResponseHeaders());
assertThat(response).isEqualTo("<response>".getBytes());
}
@Test
void consentCreationResponseHandler403JsonResponse() {
HttpClient.ResponseHandler<ConsentsResponse201> consentCreationResponseHandler =
responseHandlers.consentCreationResponseHandler(SCA_OAUTH_URL, ConsentsResponse201.class);
ByteArrayInputStream responseBody = new ByteArrayInputStream("{}".getBytes());
ResponseHeaders responseHeaders = ResponseHeaders.emptyResponseHeaders();
try {
consentCreationResponseHandler.apply(403, responseBody, responseHeaders);
fail();
} catch (OAuthException e) {
assertThat(e.getMessage()).isEqualTo("{}");
assertThat(e.getErrorResponse().getLinks().get("scaOAuth").getHref()).isEqualTo(SCA_OAUTH_URL);
}
}
@Test
void consentCreationResponseHandler403UnsupportedFormatBody() {
HttpClient.ResponseHandler<ConsentsResponse201> consentCreationResponseHandler =
responseHandlers.consentCreationResponseHandler(SCA_OAUTH_URL, ConsentsResponse201.class);
ByteArrayInputStream responseBody = new ByteArrayInputStream("<response>".getBytes());
ResponseHeaders responseHeaders = ResponseHeaders.emptyResponseHeaders();
try {
consentCreationResponseHandler.apply(403, responseBody, responseHeaders);
fail();
} catch (OAuthException e) {
assertThat(e.getMessage()).isEqualTo("<response>");
assertThat(e.getErrorResponse().getLinks().get("scaOAuth").getHref()).isEqualTo(SCA_OAUTH_URL);
}
}
@Test
void consentCreationResponseHandler403UnsupportedContentType() {
Map<String, String> headers = new HashMap<>();
headers.put(CONTENT_TYPE_HEADER, "application/xml");
HttpClient.ResponseHandler<ConsentsResponse201> consentCreationResponseHandler =
responseHandlers.consentCreationResponseHandler(SCA_OAUTH_URL, ConsentsResponse201.class);
ByteArrayInputStream responseBody = new ByteArrayInputStream("<response>".getBytes());
ResponseHeaders responseHeaders = ResponseHeaders.fromMap(headers);
try {
consentCreationResponseHandler.apply(403, responseBody, responseHeaders);
fail();
} catch (OAuthException e) {
assertThat(e.getMessage()).isEqualTo("<response>");
assertThat(e.getErrorResponse().getLinks().get("scaOAuth").getHref()).isEqualTo(SCA_OAUTH_URL);
}
}
@Test
void consentCreationResponseHandler403InJsonFormat() {
Map<String, String> headers = new HashMap<>();
headers.put(CONTENT_TYPE_HEADER, "application/json");
HttpClient.ResponseHandler<ConsentsResponse201> consentCreationResponseHandler =
responseHandlers.consentCreationResponseHandler(SCA_OAUTH_URL, ConsentsResponse201.class);
ByteArrayInputStream responseBody = new ByteArrayInputStream("{}".getBytes());
ResponseHeaders responseHeaders = ResponseHeaders.fromMap(headers);
try {
consentCreationResponseHandler.apply(403, responseBody, responseHeaders);
fail();
} catch (OAuthException e) {
assertThat(e.getMessage()).isEqualTo("{}");
assertThat(e.getErrorResponse().getLinks().get("scaOAuth").getHref()).isEqualTo(SCA_OAUTH_URL);
}
}
@Test
void consentCreationResponseHandlerParsesOnSuccessfulResponse() {
Amount amount = responseHandlers.jsonResponseHandler(Amount.class).apply(200,
new ByteArrayInputStream("{\"amount\":\"10\", \"currency\":\"EUR\"}".getBytes()),
ResponseHeaders.emptyResponseHeaders());
assertThat(amount.getAmount()).isEqualTo("10");
assertThat(amount.getCurrency()).isEqualTo("EUR");
}
@Test
void consentCreationResponseHandlerThrowsOnErrorResponseAndExceptionMessageContainsResponseBody() {
HttpClient.ResponseHandler<Amount> jsonResponseHandler = responseHandlers.jsonResponseHandler(Amount.class);
ByteArrayInputStream responseBody = new ByteArrayInputStream("{}".getBytes());
ResponseHeaders responseHeaders = ResponseHeaders.emptyResponseHeaders();
try {
jsonResponseHandler.apply(400, responseBody, responseHeaders);
fail();
} catch (ErrorResponseException e) {
assertThat(e.getMessage()).isEqualTo("{}");
}
}
@Test
void consentCreationResponseHandlerThrowsErrorOnUnsupportedFormatBody() {
HttpClient.ResponseHandler<Amount> jsonResponseHandler = responseHandlers.jsonResponseHandler(Amount.class);
ByteArrayInputStream responseBody = new ByteArrayInputStream("<response>".getBytes());
ResponseHeaders responseHeaders = ResponseHeaders.emptyResponseHeaders();
try {
jsonResponseHandler.apply(400, responseBody, responseHeaders);
fail();
} catch (ErrorResponseException e) {
assertThat(e.getMessage()).isEqualTo("<response>");
}
}
@Test
void consentCreationResponseHandlerThrowsErrorOnUnsupportedContentType() {
Map<String, String> headers = new HashMap<>();
headers.put(CONTENT_TYPE_HEADER, "application/xml");
HttpClient.ResponseHandler<Amount> jsonResponseHandler = responseHandlers.jsonResponseHandler(Amount.class);
ByteArrayInputStream responseBody = new ByteArrayInputStream("<response>".getBytes());
ResponseHeaders responseHeaders = ResponseHeaders.fromMap(headers);
try {
jsonResponseHandler.apply(400, responseBody, responseHeaders);
fail();
} catch (ErrorResponseException e) {
assertThat(e.getMessage()).isEqualTo("<response>");
}
}
@Test
void consentCreationResponseHandlerThrowsErrorInJsonFormat() {
Map<String, String> headers = new HashMap<>();
headers.put(CONTENT_TYPE_HEADER, "application/json");
HttpClient.ResponseHandler<Amount> jsonResponseHandler = responseHandlers.jsonResponseHandler(Amount.class);
ByteArrayInputStream responseBody = new ByteArrayInputStream("{}".getBytes());
ResponseHeaders responseHeaders = ResponseHeaders.fromMap(headers);
try {
jsonResponseHandler.apply(400, responseBody, responseHeaders);
fail();
} catch (ErrorResponseException e) {
assertThat(e.getMessage()).isEqualTo("{}");
}
}
@Test
void multipartFormDataResponseHandlerThrowsWhenContentTypeNotSpecified() {
HttpClient.ResponseHandler<PeriodicPaymentInitiationMultipartBody> multipartFormDataResponseHandler =
responseHandlers.multipartFormDataResponseHandler(PeriodicPaymentInitiationMultipartBody.class);
ResponseHeaders responseHeaders = ResponseHeaders.emptyResponseHeaders();
HttpClientException exception = assertThrows(HttpClientException.class,
() -> multipartFormDataResponseHandler.apply(200, null, responseHeaders));
assertThat(exception.getMessage()).isEqualTo("Unexpected content type: null");
}
@Test
void multipartFormDataResponseHandlerThrowsWhenContentTypeSpecifiedIsNotMultipartFormData() {
HttpClient.ResponseHandler<PeriodicPaymentInitiationMultipartBody> multipartFormDataResponseHandler =
responseHandlers.multipartFormDataResponseHandler(PeriodicPaymentInitiationMultipartBody.class);
ResponseHeaders responseHeaders = ResponseHeaders.fromMap(singletonMap("Content-Type", "application/xml"));
HttpClientException exception = assertThrows(HttpClientException.class,
() -> multipartFormDataResponseHandler.apply(200, null, responseHeaders));
assertThat(exception.getMessage()).isEqualTo("Unexpected content type: application/xml");
}
@Test
void multipartFormDataResponseHandlerThrowsWhenBoundaryNotSpecified() {
HttpClient.ResponseHandler<PeriodicPaymentInitiationMultipartBody> multipartFormDataResponseHandler =
responseHandlers.multipartFormDataResponseHandler(PeriodicPaymentInitiationMultipartBody.class);
ResponseHeaders responseHeaders = ResponseHeaders.fromMap(singletonMap("Content-Type", "multipart/form-data"));
HttpClientException exception = assertThrows(HttpClientException.class,
() -> multipartFormDataResponseHandler.apply(200, null, responseHeaders));
assertThat(exception.getMessage()).contains("boundary");
}
@Test
void multipartFormDataResponseHandlerThrowsWhenPartNameDoesNotMatchAnyObjectProperties() {
HttpClient.ResponseHandler<PeriodicPaymentInitiationMultipartBody> multipartFormDataResponseHandler =
responseHandlers.multipartFormDataResponseHandler(PeriodicPaymentInitiationMultipartBody.class);
String body = "--wYxajuhgWlVdGgMi-GoYM7orJaBzQ0z6JffqaC\r\n" +
"Content-Disposition: form-data; name=\"unexpected_part_name\"\r\n" +
"Content-Type: application/xml\r\n" +
"\r\n" +
"<Document></Document>\r\n" +
"--wYxajuhgWlVdGgMi-GoYM7orJaBzQ0z6JffqaC--\r\n";
Map<String, String> headers = singletonMap("Content-Type",
"multipart/form-data; boundary=wYxajuhgWlVdGgMi-GoYM7orJaBzQ0z6JffqaC;charset=UTF-8");
ByteArrayInputStream responseBody = new ByteArrayInputStream(body.getBytes());
ResponseHeaders responseHeaders = ResponseHeaders.fromMap(headers);
assertThrows(RuntimeException.class,
() -> multipartFormDataResponseHandler.apply(200, responseBody, responseHeaders));
}
@Test
void multipartFormDataResponseHandlerCanDeserializePeriodicPaymentInitiationMultipartBody() {
String responseBody = "--wYxajuhgWlVdGgMi-GoYM7orJaBzQ0z6JffqaC\r\n" +
"Content-Disposition: form-data; name=\"xml_sct\"\r\n" +
"Content-Type: application/xml\r\n" +
"\r\n" +
"<Document></Document>\r\n" +
"--wYxajuhgWlVdGgMi-GoYM7orJaBzQ0z6JffqaC\r\n" +
"Content-Disposition: form-data; name=\"json_standingorderType\"\r\n" +
"Content-Type: application/json\r\n" +
"\r\n" +
"{\"startDate\":\"2018-03-01\",\"executionRule\":\"following\",\"frequency\":\"Monthly\"}\r\n" +
"--wYxajuhgWlVdGgMi-GoYM7orJaBzQ0z6JffqaC--\r\n";
Map<String, String> headers = singletonMap("Content-Type",
"multipart/form-data; boundary=wYxajuhgWlVdGgMi-GoYM7orJaBzQ0z6JffqaC;charset=UTF-8");
PeriodicPaymentInitiationMultipartBody expected = new PeriodicPaymentInitiationMultipartBody();
expected.setXml_sct("<Document></Document>");
PeriodicPaymentInitiationXmlPart2StandingorderTypeJson json = new PeriodicPaymentInitiationXmlPart2StandingorderTypeJson();
json.setStartDate(LocalDate.of(2018, 3, 1));
json.setExecutionRule(ExecutionRule.FOLLOWING);
json.setFrequency(FrequencyCode.MONTHLY);
expected.setJson_standingorderType(json);
PeriodicPaymentInitiationMultipartBody actual =
responseHandlers.multipartFormDataResponseHandler(PeriodicPaymentInitiationMultipartBody.class)
.apply(200, new ByteArrayInputStream(responseBody.getBytes()), ResponseHeaders.fromMap(headers));
assertThat(actual).isEqualTo(expected);
}
}
| 18,070 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
ApacheHttpClientTest.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/test/java/de/adorsys/xs2a/adapter/impl/http/ApacheHttpClientTest.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl.http;
import de.adorsys.xs2a.adapter.api.Response;
import de.adorsys.xs2a.adapter.api.http.Request;
import org.apache.http.impl.client.CloseableHttpClient;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.mock;
class ApacheHttpClientTest {
public static final String URI = "https://test.uri";
private CloseableHttpClient httpClient = mock(CloseableHttpClient.class);
private ApacheHttpClient client = new ApacheHttpClient(null, httpClient);
@Test
void put() {
Request.Builder actual = client.put(URI);
assertEquals("PUT", actual.method());
assertEquals(URI, actual.uri());
}
@Test
void delete() {
Request.Builder actual = client.delete(URI);
assertEquals("DELETE", actual.method());
assertEquals(URI, actual.uri());
}
@Test
void content_getMethod() {
String actual = client.content(new RequestBuilderImpl(client, "GET", URI));
assertNotNull(actual);
assertTrue(actual.isEmpty());
}
@Test
void content_postMethod() {
Request.Builder request = new RequestBuilderImpl(client, "POST", URI);
request.emptyBody(true);
String actual = client.content(request);
assertNotNull(actual);
assertEquals("{}", actual);
}
@Test
void content_putMethod() {
Request.Builder request = new RequestBuilderImpl(client, "PUT", URI);
request.jsonBody("body");
String actual = client.content(request);
assertNotNull(actual);
assertEquals("body", actual);
}
@Test
void content_deleteMethod() {
String actual = client.content(new RequestBuilderImpl(client, "DELETE", URI));
assertNotNull(actual);
assertTrue(actual.isEmpty());
}
@Test
void content_throwsException() {
RequestBuilderImpl requestBuilder = new RequestBuilderImpl(client, "METHOD", URI);
UnsupportedOperationException exception = assertThrows(UnsupportedOperationException.class,
() -> client.content(requestBuilder));
assertEquals("METHOD", exception.getMessage());
}
private Response<String> dummyResponse() {
return new Response<>(-1, "body", null);
}
}
| 3,175 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
HttpHeadersTest.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/test/java/de/adorsys/xs2a/adapter/impl/http/HttpHeadersTest.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl.http;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
class HttpHeadersTest {
@Test
void parse() {
HttpHeaders httpHeaders = HttpHeaders.parse("Content-Disposition: form-data; name=\"xml_sct\"\r\n" +
"Content-Type: application/xml\r\n" +
"Content-Length: 1434\r\n\r\n");
assertThat(httpHeaders.size()).isEqualTo(3);
}
@Test
void parseToleratesLFsInsteadOfCRLFs() {
HttpHeaders httpHeaders = HttpHeaders.parse("Content-Disposition: form-data; name=\"xml_sct\"\n" +
"Content-Type: application/xml\n" +
"Content-Length: 1434\n\n");
assertThat(httpHeaders.size()).isEqualTo(3);
}
}
| 1,601 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
WiremockStubDifferenceDetectingInterceptorTest.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/test/java/de/adorsys/xs2a/adapter/impl/http/wiremock/WiremockStubDifferenceDetectingInterceptorTest.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl.http.wiremock;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import de.adorsys.xs2a.adapter.api.RequestHeaders;
import de.adorsys.xs2a.adapter.api.Response;
import de.adorsys.xs2a.adapter.api.ResponseHeaders;
import de.adorsys.xs2a.adapter.api.http.HttpClient;
import de.adorsys.xs2a.adapter.api.http.Interceptor;
import de.adorsys.xs2a.adapter.api.model.Aspsp;
import de.adorsys.xs2a.adapter.api.model.Consents;
import de.adorsys.xs2a.adapter.api.model.ConsentsResponse201;
import de.adorsys.xs2a.adapter.impl.http.RequestBuilderImpl;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.stream.Collectors;
import static de.adorsys.xs2a.adapter.impl.http.wiremock.TestInstancesSupplier.*;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
class WiremockStubDifferenceDetectingInterceptorTest {
private static final String X_REQUEST_ID_VALUE = "some-id";
private static final String CONSENTS_URL = "https://bank.com/v1/consents";
private static final String INITIATE_PAYMENT_PAYMENTS_PAIN_URL = "https://bank.com/v1/payments/pain.001-sepa-credit-transfers";
private static final String INITIATE_PAYMENT_PERIODIC_PAIN_URL = "https://bank.com/v1/periodic-payments/pain.001-sepa-credit-transfers";
private static final String POST = "POST";
private static final String GET = "GET";
private static final String REQUEST_URL_VALUE = "url";
private static final String REQUEST_HEADERS_VALUE = "request-headers";
private static final String REQUEST_PAYLOAD_VALUE = "request-payload";
private static final String RESPONSE_PAYLOAD_VALUE = "response-payload";
private static final String PSU_ID_VALUE = "max.musterman";
private static final String CONTENT_TYPE_JSON_VALUE = "application/json; charset=UTF-8";
private static final String CONTENT_TYPE_XML_VALUE = "application/xml; charset=ISO-8859-1";
private static final String CONTENT_TYPE_MULTIPART_VALUE = "multipart/form-data; boundary=123456";
private static final String PSU_IP_ADDRESS_VALUE = "0.0.0.0";
private static final String TPP_REDIRECT_URI_VALUE = "http://example.com";
private static final String XML_BODY = "<test></test>";
private static final String PAYMENT_INITIATION_BODY_FILE = "payment-initiation-body.xml";
private static final Logger logger = LoggerFactory.getLogger(WiremockStubDifferenceDetectingInterceptorTest.class);
private final HttpClient httpClient = mock(HttpClient.class);
private final Aspsp aspsp = getAspsp();
private final Interceptor interceptor = new WiremockStubDifferenceDetectingInterceptor(aspsp);
@Test
void postHandle_allMatch() throws JsonProcessingException {
RequestBuilderImpl request = new RequestBuilderImpl(httpClient, GET, "https://bank.com/v1/accounts");
request.header(RequestHeaders.X_REQUEST_ID, X_REQUEST_ID_VALUE);
request.header(RequestHeaders.CONSENT_ID, "consent-id");
Response<?> actualResponse = interceptor
.postHandle(request,
getResponse(writeValueAsString(getAccountList()),
getResponseHeaders(ResponseHeaders.CONTENT_TYPE, CONTENT_TYPE_JSON_VALUE)));
assertThat(actualResponse.getHeaders().getHeadersMap())
.doesNotContainKey(ResponseHeaders.X_GTW_ASPSP_CHANGES_DETECTED);
}
@Test
void postHandle_ContentTypeNotMatching() throws JsonProcessingException {
RequestBuilderImpl request = new RequestBuilderImpl(httpClient, POST, CONSENTS_URL);
request.header(RequestHeaders.X_REQUEST_ID, X_REQUEST_ID_VALUE);
request.header(RequestHeaders.CONTENT_TYPE, "application/json");
request.header(RequestHeaders.PSU_ID, PSU_ID_VALUE);
request.header(RequestHeaders.PSU_IP_ADDRESS, PSU_IP_ADDRESS_VALUE);
request.header(RequestHeaders.TPP_REDIRECT_URI, TPP_REDIRECT_URI_VALUE);
Response<?> actualResponse = interceptor
.postHandle(request,
getResponse(writeValueAsString(getAccountList()),
getResponseHeaders(ResponseHeaders.CONTENT_TYPE, CONTENT_TYPE_JSON_VALUE)));
assertThat(actualResponse.getHeaders().getHeadersMap())
.containsKey(ResponseHeaders.X_GTW_ASPSP_CHANGES_DETECTED)
.extractingByKey(ResponseHeaders.X_GTW_ASPSP_CHANGES_DETECTED)
.matches(val -> val.contains(REQUEST_HEADERS_VALUE));
}
@Test
void postHandle_ParamsNotMatching() throws JsonProcessingException {
RequestBuilderImpl request = new RequestBuilderImpl(httpClient, "GET", "/v1/accounts/123123/transactions?dateFrom=1990-01-01&dateTo=1990-12-31d&bookingStatus=booked&withBalance=false");
request.header(RequestHeaders.X_REQUEST_ID, X_REQUEST_ID_VALUE);
request.header(RequestHeaders.CONTENT_TYPE, "application/json");
request.header(RequestHeaders.PSU_ID, PSU_ID_VALUE);
request.header(RequestHeaders.PSU_IP_ADDRESS, PSU_IP_ADDRESS_VALUE);
request.header(RequestHeaders.TPP_REDIRECT_URI, TPP_REDIRECT_URI_VALUE);
Response<?> actualResponse = interceptor
.postHandle(request, getResponse(writeValueAsString(getAccountList()),
getResponseHeaders(ResponseHeaders.CONTENT_TYPE, CONTENT_TYPE_JSON_VALUE)));
assertThat(actualResponse.getHeaders().getHeadersMap())
.containsKey(ResponseHeaders.X_GTW_ASPSP_CHANGES_DETECTED)
.extractingByKey(ResponseHeaders.X_GTW_ASPSP_CHANGES_DETECTED)
.matches(val -> val.contains(REQUEST_URL_VALUE));
}
@Test
void postHandle_notMatchingHeaders() throws JsonProcessingException {
RequestBuilderImpl request = new RequestBuilderImpl(httpClient, POST, CONSENTS_URL);
request.jsonBody(writeValueAsString(getConsents()));
request.header(ResponseHeaders.CONTENT_TYPE, CONTENT_TYPE_JSON_VALUE);
Response<?> actualResponse = interceptor
.postHandle(request,
getResponse(writeValueAsString(getConsentResponse201()),
getResponseHeaders(ResponseHeaders.CONTENT_TYPE, CONTENT_TYPE_JSON_VALUE)));
assertThat(actualResponse.getHeaders().getHeadersMap())
.containsKey(ResponseHeaders.X_GTW_ASPSP_CHANGES_DETECTED)
.extractingByKey(ResponseHeaders.X_GTW_ASPSP_CHANGES_DETECTED)
.matches(val -> val.contains(REQUEST_HEADERS_VALUE))
.matches(val -> !val.contains(REQUEST_PAYLOAD_VALUE))
.matches(val -> !val.contains(RESPONSE_PAYLOAD_VALUE));
}
@Test
void postHandle_jsonBody_notMatchingRequestBody() throws JsonProcessingException {
RequestBuilderImpl request = new RequestBuilderImpl(httpClient, POST, CONSENTS_URL);
request.jsonBody(writeValueAsString(new Consents()));
request.header(RequestHeaders.X_REQUEST_ID, X_REQUEST_ID_VALUE);
request.header(RequestHeaders.PSU_ID, PSU_ID_VALUE);
request.header(RequestHeaders.CONTENT_TYPE, CONTENT_TYPE_JSON_VALUE);
request.header(RequestHeaders.PSU_IP_ADDRESS, PSU_IP_ADDRESS_VALUE);
request.header(RequestHeaders.TPP_REDIRECT_URI, TPP_REDIRECT_URI_VALUE);
Response<?> actualResponse = interceptor
.postHandle(request,
getResponse(writeValueAsString(getConsentResponse201()),
getResponseHeaders(ResponseHeaders.CONTENT_TYPE, CONTENT_TYPE_JSON_VALUE)));
assertThat(actualResponse.getHeaders().getHeadersMap())
.containsKey(ResponseHeaders.X_GTW_ASPSP_CHANGES_DETECTED)
.extractingByKey(ResponseHeaders.X_GTW_ASPSP_CHANGES_DETECTED)
.matches(val -> val.contains(REQUEST_PAYLOAD_VALUE))
.matches(val -> !val.contains(REQUEST_HEADERS_VALUE))
.matches(val -> !val.contains(RESPONSE_PAYLOAD_VALUE));
}
@Test
void postHandle_jsonBody_notMatchingResponseBody() throws JsonProcessingException {
RequestBuilderImpl request = new RequestBuilderImpl(httpClient, POST, CONSENTS_URL);
request.jsonBody(writeValueAsString(getConsents()));
request.header(RequestHeaders.X_REQUEST_ID, X_REQUEST_ID_VALUE);
request.header(RequestHeaders.PSU_ID, PSU_ID_VALUE);
request.header(RequestHeaders.CONTENT_TYPE, CONTENT_TYPE_JSON_VALUE);
request.header(RequestHeaders.PSU_IP_ADDRESS, PSU_IP_ADDRESS_VALUE);
request.header(RequestHeaders.TPP_REDIRECT_URI, TPP_REDIRECT_URI_VALUE);
Response<?> actualResponse = interceptor
.postHandle(request,
getResponse(new ConsentsResponse201(),
getResponseHeaders(ResponseHeaders.CONTENT_TYPE, CONTENT_TYPE_JSON_VALUE)));
assertThat(actualResponse.getHeaders().getHeadersMap())
.containsKey(ResponseHeaders.X_GTW_ASPSP_CHANGES_DETECTED)
.extractingByKey(ResponseHeaders.X_GTW_ASPSP_CHANGES_DETECTED)
.matches(val -> val.contains(RESPONSE_PAYLOAD_VALUE))
.matches(val -> !val.contains(REQUEST_PAYLOAD_VALUE))
.matches(val -> !val.contains(REQUEST_HEADERS_VALUE));
}
@Test
void postHandle_jsonBody_notMatchingRequestResponseBodyValues() throws JsonProcessingException {
Consents requestBody = getConsents();
requestBody.setFrequencyPerDay(1);
ConsentsResponse201 responseBody = getConsentResponse201();
responseBody.setConsentId("wrong_id");
RequestBuilderImpl request = new RequestBuilderImpl(httpClient, POST, CONSENTS_URL);
request.jsonBody(writeValueAsString(requestBody));
request.header(RequestHeaders.X_REQUEST_ID, X_REQUEST_ID_VALUE);
request.header(RequestHeaders.PSU_ID, PSU_ID_VALUE);
request.header(RequestHeaders.CONTENT_TYPE, CONTENT_TYPE_JSON_VALUE);
request.header(RequestHeaders.PSU_IP_ADDRESS, PSU_IP_ADDRESS_VALUE);
request.header(RequestHeaders.TPP_REDIRECT_URI, TPP_REDIRECT_URI_VALUE);
Response<?> actualResponse = interceptor
.postHandle(request,
getResponse(writeValueAsString(responseBody),
getResponseHeaders(ResponseHeaders.CONTENT_TYPE, CONTENT_TYPE_JSON_VALUE)));
assertThat(actualResponse.getHeaders().getHeadersMap())
.containsKey(ResponseHeaders.X_GTW_ASPSP_CHANGES_DETECTED)
.extractingByKey(ResponseHeaders.X_GTW_ASPSP_CHANGES_DETECTED)
.matches(val -> val.contains(RESPONSE_PAYLOAD_VALUE))
.matches(val -> val.contains(REQUEST_PAYLOAD_VALUE))
.matches(val -> !val.contains(REQUEST_HEADERS_VALUE));
}
@Test
void postHandle_nothingMatches() throws JsonProcessingException {
RequestBuilderImpl request = new RequestBuilderImpl(httpClient, POST, CONSENTS_URL);
request.jsonBody(writeValueAsString(new Consents()));
request.header(ResponseHeaders.CONTENT_TYPE, CONTENT_TYPE_JSON_VALUE);
Response<?> actualResponse = interceptor
.postHandle(request,
getResponse("",
getResponseHeaders(ResponseHeaders.CONTENT_TYPE, CONTENT_TYPE_JSON_VALUE)));
assertThat(actualResponse.getHeaders().getHeadersMap())
.containsKey(ResponseHeaders.X_GTW_ASPSP_CHANGES_DETECTED)
.extractingByKey(ResponseHeaders.X_GTW_ASPSP_CHANGES_DETECTED)
.matches(val -> val.contains(RESPONSE_PAYLOAD_VALUE))
.matches(val -> val.contains(REQUEST_PAYLOAD_VALUE))
.matches(val -> val.contains(REQUEST_HEADERS_VALUE));
}
@Test
void postHandle_xmlBody_allMatches() {
RequestBuilderImpl request
= new RequestBuilderImpl(httpClient, POST, INITIATE_PAYMENT_PAYMENTS_PAIN_URL);
String body = getXmlAsString(PAYMENT_INITIATION_BODY_FILE);
request.xmlBody(body);
request.header(RequestHeaders.X_REQUEST_ID, X_REQUEST_ID_VALUE);
request.header(RequestHeaders.PSU_ID, PSU_ID_VALUE);
request.header(RequestHeaders.CONTENT_TYPE, CONTENT_TYPE_XML_VALUE);
request.header(RequestHeaders.PSU_IP_ADDRESS, PSU_IP_ADDRESS_VALUE);
request.header(RequestHeaders.TPP_REDIRECT_URI, TPP_REDIRECT_URI_VALUE);
Response<?> actualResponse = interceptor
.postHandle(request,
getResponse(getPaymentInitiationRequestResponse201(),
getResponseHeaders(ResponseHeaders.CONTENT_TYPE, CONTENT_TYPE_JSON_VALUE)));
assertThat(actualResponse.getHeaders().getHeadersMap())
.doesNotContainKey(ResponseHeaders.X_GTW_ASPSP_CHANGES_DETECTED);
}
@Test
void postHandle_xmlBody_notMatchingResponseBody() {
RequestBuilderImpl request
= new RequestBuilderImpl(httpClient, GET, "https://bank.com/v1/payments/pain.001-sepa-credit-transfers/foo/status");
request.header(RequestHeaders.X_REQUEST_ID, X_REQUEST_ID_VALUE);
request.header(RequestHeaders.DIGEST, "digest");
request.header(RequestHeaders.DATE, "date");
request.header(RequestHeaders.SIGNATURE, "signature");
request.header(RequestHeaders.TPP_SIGNATURE_CERTIFICATE, "certificate");
Response<?> actualResponse = interceptor
.postHandle(request,
getResponse(XML_BODY,
getResponseHeaders(ResponseHeaders.CONTENT_TYPE, CONTENT_TYPE_XML_VALUE)));
assertThat(actualResponse.getHeaders().getHeadersMap())
.containsKey(ResponseHeaders.X_GTW_ASPSP_CHANGES_DETECTED)
.extractingByKey(ResponseHeaders.X_GTW_ASPSP_CHANGES_DETECTED)
.matches(val -> val.contains(RESPONSE_PAYLOAD_VALUE))
.matches(val -> !val.contains(REQUEST_PAYLOAD_VALUE))
.matches(val -> !val.contains(REQUEST_HEADERS_VALUE));
}
@Test
void postHandle_xmlBody_notMatchingRequestBody() {
RequestBuilderImpl request
= new RequestBuilderImpl(httpClient, POST, INITIATE_PAYMENT_PAYMENTS_PAIN_URL);
request.xmlBody(XML_BODY);
request.header(RequestHeaders.X_REQUEST_ID, X_REQUEST_ID_VALUE);
request.header(RequestHeaders.PSU_ID, PSU_ID_VALUE);
request.header(RequestHeaders.CONTENT_TYPE, CONTENT_TYPE_XML_VALUE);
request.header(RequestHeaders.PSU_IP_ADDRESS, PSU_IP_ADDRESS_VALUE);
request.header(RequestHeaders.TPP_REDIRECT_URI, TPP_REDIRECT_URI_VALUE);
Response<?> actualResponse = interceptor
.postHandle(request,
getResponse(getPaymentInitiationRequestResponse201(),
getResponseHeaders(ResponseHeaders.CONTENT_TYPE, CONTENT_TYPE_JSON_VALUE)));
assertThat(actualResponse.getHeaders().getHeadersMap())
.containsKey(ResponseHeaders.X_GTW_ASPSP_CHANGES_DETECTED)
.extractingByKey(ResponseHeaders.X_GTW_ASPSP_CHANGES_DETECTED)
.matches(val -> val.contains(REQUEST_PAYLOAD_VALUE))
.matches(val -> !val.contains(REQUEST_HEADERS_VALUE))
.matches(val -> !val.contains(RESPONSE_PAYLOAD_VALUE));
}
@Test
void postHandle_multipartBody_allMatches() throws JsonProcessingException {
RequestBuilderImpl request
= new RequestBuilderImpl(httpClient, POST, INITIATE_PAYMENT_PERIODIC_PAIN_URL);
String body = getXmlAsString(PAYMENT_INITIATION_BODY_FILE);
request.addXmlPart("xml_sct", body);
request.addJsonPart("json_standingorderType",
writeValueAsString(getPeriodicPaymentInitiationXmlPart2StandingorderTypeJson()));
request.header(RequestHeaders.X_REQUEST_ID, X_REQUEST_ID_VALUE);
request.header(RequestHeaders.PSU_ID, PSU_ID_VALUE);
request.header(RequestHeaders.CONTENT_TYPE, CONTENT_TYPE_MULTIPART_VALUE);
Response<?> actualResponse = interceptor
.postHandle(request,
getResponse(getPaymentInitiationRequestResponse201(),
getResponseHeaders(ResponseHeaders.CONTENT_TYPE, CONTENT_TYPE_JSON_VALUE)));
assertThat(actualResponse.getHeaders().getHeadersMap())
.doesNotContainKey(ResponseHeaders.X_GTW_ASPSP_CHANGES_DETECTED);
}
@Test
void postHandle_multipartBody_notMatchingMultipartBody() {
RequestBuilderImpl request
= new RequestBuilderImpl(httpClient, POST, INITIATE_PAYMENT_PERIODIC_PAIN_URL);
request.addXmlPart("xml_fake", XML_BODY);
request.addJsonPart("json_standingorderFake", "{}");
request.header(RequestHeaders.X_REQUEST_ID, X_REQUEST_ID_VALUE);
request.header(RequestHeaders.PSU_ID, PSU_ID_VALUE);
request.header(RequestHeaders.CONTENT_TYPE, CONTENT_TYPE_MULTIPART_VALUE);
Response<?> actualResponse = interceptor
.postHandle(request,
getResponse(getPaymentInitiationRequestResponse201(),
getResponseHeaders(ResponseHeaders.CONTENT_TYPE, CONTENT_TYPE_JSON_VALUE)));
assertThat(actualResponse.getHeaders().getHeadersMap())
.containsKey(ResponseHeaders.X_GTW_ASPSP_CHANGES_DETECTED)
.extractingByKey(ResponseHeaders.X_GTW_ASPSP_CHANGES_DETECTED)
.matches(val -> val.contains(REQUEST_PAYLOAD_VALUE))
.matches(val -> !val.contains(REQUEST_HEADERS_VALUE))
.matches(val -> !val.contains(RESPONSE_PAYLOAD_VALUE));
}
@Test
void isWiremockSupported() {
assertThat(WiremockStubDifferenceDetectingInterceptor.isWiremockSupported("adorsys-adapter"))
.isTrue();
assertThat(WiremockStubDifferenceDetectingInterceptor.isWiremockSupported("foo-adapter"))
.isFalse();
}
private String getXmlAsString(String path) {
String xml = null;
try {
URI uri = getClass().getClassLoader().getResource(path).toURI();
xml = Files.lines(Paths.get(uri)).collect(Collectors.joining());
} catch (IOException | URISyntaxException e) {
logger.error("Failed to read xml file", e);
}
return xml;
}
private <T> String writeValueAsString(T object) throws JsonProcessingException {
return new ObjectMapper()
.setSerializationInclusion(JsonInclude.Include.NON_NULL)
.registerModule(new JavaTimeModule()
.addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern("yyyyMMdd"))))
.writeValueAsString(object);
}
}
| 21,068 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
WiremockFileTypeTest.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/test/java/de/adorsys/xs2a/adapter/impl/http/wiremock/WiremockFileTypeTest.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl.http.wiremock;
import org.junit.jupiter.api.Test;
import static de.adorsys.xs2a.adapter.impl.http.wiremock.WiremockFileType.*;
import static org.junit.jupiter.api.Assertions.*;
class WiremockFileTypeTest {
private static final String DELETE_METHOD = "DELETE";
private static final String POST_METHOD = "POST";
private static final String PUT_METHOD = "PUT";
private static final String GET_METHOD = "GET";
private static final String CONSENTS_URI = "/v1/consents";
private static final String ACCOUNTS_URI = "/v1/accounts";
private static final String PAYMENTS_SCT_URI = "/v1/payments/sepa-credit-transfers";
private static final String PAYMENTS_PAIN001_SCT_URI = "/v1/payments/pain.001-sepa-credit-transfers";
private static final String PERIODIC_SCT_URI = "/v1/periodic-payments/sepa-credit-transfers";
private static final String PERIODIC_PAIN001_CST_URI = "/v1/periodic-payments/pain.001-sepa-credit-transfers";
// Flawed data
private static final String FLAWED_URI = "/foo/boo";
private static final String FLAWED_BODY = "{\"foo\": \"boo\"}";
private static final String FLAWED_METHOD = "FOO";
// Decent data
private static final String BOO_AUTHORISATIONS_URI = "/boo/authorisations";
private static final String BOO_STATUS_URI = "/boo/status";
// AIS
private static final String CONSENT_STATUS_URI = CONSENTS_URI + BOO_STATUS_URI;
private static final String AIS_START_PSU_AUTHORISATION_URI = CONSENTS_URI + BOO_AUTHORISATIONS_URI;
private static final String AIS_SCA_URI = AIS_START_PSU_AUTHORISATION_URI + "/foo";
private static final String TRANSACTIONS_URI = ACCOUNTS_URI + "/boo/transactions";
// PIS
private static final String PAYMENTS_SCT_AUTHORISATIONS_URI = PAYMENTS_SCT_URI + BOO_AUTHORISATIONS_URI;
private static final String PAYMENTS_PAIN001_SCT_AUTHORISATIONS_URI = PAYMENTS_PAIN001_SCT_URI + BOO_AUTHORISATIONS_URI;
private static final String PERIODIC_SCT_AUTHORISATIONS_URI = PERIODIC_SCT_URI + BOO_AUTHORISATIONS_URI;
private static final String PERIODIC_PAIN001_SCT_AUTHORISATIONS_URI = PERIODIC_PAIN001_CST_URI + BOO_AUTHORISATIONS_URI;
private static final String PAYMENTS_SCT_PAYMENT_STATUS_URI = PAYMENTS_SCT_URI + BOO_STATUS_URI;
private static final String PAYMENTS_PAIN001_SCT_PAYMENT_STATUS_URI = PAYMENTS_PAIN001_SCT_URI + BOO_STATUS_URI;
private static final String PERIODIC_SCT_PAYMENT_STATUS_URI = PERIODIC_SCT_URI + BOO_STATUS_URI;
private static final String PERIODIC_PAIN001_SCT_PAYMENT_STATUS_URI = PERIODIC_PAIN001_CST_URI + BOO_STATUS_URI;
private static final String PAYMENTS_SCT_SCA_STATUS_URI = PAYMENTS_SCT_URI + BOO_AUTHORISATIONS_URI;
private static final String PAYMENTS_PAIN001_SCT_SCA_STATUS_URI = PAYMENTS_PAIN001_SCT_URI + BOO_AUTHORISATIONS_URI;
private static final String PERIODIC_SCT_SCA_STATUS_URI = PERIODIC_SCT_URI + BOO_AUTHORISATIONS_URI;
private static final String PERIODIC_PAIN001_SCT_SCA_STATUS_URI = PERIODIC_PAIN001_CST_URI + BOO_AUTHORISATIONS_URI;
// Both
private static final String PSU_DATA_BODY = "{\"psuData\": \"\"}";
private static final String AUTHENTICATION_METHOD_ID_BODY = "{\"authenticationMethodId\": \"\"}";
private static final String SCA_AUTHENTICATION_DATA_BODY = "{\"scaAuthenticationData\": \"\"}";
@Test
void aisCreateConsent() {
assertTrue(AIS_CREATE_CONSENT.check(CONSENTS_URI, POST_METHOD, null));
assertFalse(AIS_CREATE_CONSENT.check(FLAWED_URI, POST_METHOD, null));
assertFalse(AIS_CREATE_CONSENT.check(CONSENTS_URI, FLAWED_METHOD, null));
}
@Test
void aisStartPsuAuthentication() {
assertTrue(AIS_START_PSU_AUTHENTICATION.check(AIS_START_PSU_AUTHORISATION_URI, POST_METHOD, null));
assertFalse(AIS_START_PSU_AUTHENTICATION.check(FLAWED_URI, POST_METHOD, null));
assertFalse(AIS_START_PSU_AUTHENTICATION.check(AIS_START_PSU_AUTHORISATION_URI, FLAWED_METHOD, null));
}
@Test
void aisUpdatePsuAuthentication() {
assertTrue(AIS_UPDATE_PSU_AUTHENTICATION.check(CONSENTS_URI, PUT_METHOD, PSU_DATA_BODY));
assertFalse(AIS_UPDATE_PSU_AUTHENTICATION.check(FLAWED_URI, PUT_METHOD, PSU_DATA_BODY));
assertFalse(AIS_UPDATE_PSU_AUTHENTICATION.check(CONSENTS_URI, FLAWED_METHOD, PSU_DATA_BODY));
assertFalse(AIS_UPDATE_PSU_AUTHENTICATION.check(CONSENTS_URI, PUT_METHOD, FLAWED_BODY));
}
@Test
void aisSelectScaMethod() {
assertTrue(AIS_SELECT_SCA_METHOD.check(CONSENTS_URI, PUT_METHOD, AUTHENTICATION_METHOD_ID_BODY));
assertFalse(AIS_SELECT_SCA_METHOD.check(FLAWED_URI, PUT_METHOD, AUTHENTICATION_METHOD_ID_BODY));
assertFalse(AIS_SELECT_SCA_METHOD.check(CONSENTS_URI, FLAWED_METHOD, AUTHENTICATION_METHOD_ID_BODY));
assertFalse(AIS_SELECT_SCA_METHOD.check(CONSENTS_URI, PUT_METHOD, FLAWED_BODY));
}
@Test
void aisSendOtp() {
assertTrue(AIS_SEND_OTP.check(CONSENTS_URI, PUT_METHOD, SCA_AUTHENTICATION_DATA_BODY));
assertFalse(AIS_SEND_OTP.check(FLAWED_URI, PUT_METHOD, SCA_AUTHENTICATION_DATA_BODY));
assertFalse(AIS_SEND_OTP.check(CONSENTS_URI, FLAWED_METHOD, SCA_AUTHENTICATION_DATA_BODY));
assertFalse(AIS_SEND_OTP.check(CONSENTS_URI, PUT_METHOD, FLAWED_BODY));
}
@Test
void aisGetAccounts() {
assertTrue(AIS_GET_ACCOUNTS.check(ACCOUNTS_URI, GET_METHOD, null));
assertFalse(AIS_GET_ACCOUNTS.check(FLAWED_URI, GET_METHOD, null));
assertFalse(AIS_GET_ACCOUNTS.check(ACCOUNTS_URI, FLAWED_METHOD, null));
}
@Test
void aisGetTransactions() {
assertTrue(AIS_GET_TRANSACTIONS.check(TRANSACTIONS_URI, GET_METHOD, null));
assertFalse(AIS_GET_TRANSACTIONS.check(FLAWED_URI, GET_METHOD, null));
assertFalse(AIS_GET_TRANSACTIONS.check(TRANSACTIONS_URI, FLAWED_METHOD, null));
}
@Test
void aisDeleteConsent() {
assertTrue(AIS_DELETE_CONSENT.check(CONSENTS_URI, DELETE_METHOD, null));
assertFalse(AIS_DELETE_CONSENT.check(FLAWED_URI, DELETE_METHOD, null));
assertFalse(AIS_DELETE_CONSENT.check(CONSENTS_URI, FLAWED_METHOD, null));
}
@Test
void aisGetScaStatus() {
assertTrue(AIS_GET_SCA_STATUS.check(AIS_SCA_URI, GET_METHOD, null));
assertFalse(AIS_GET_SCA_STATUS.check(FLAWED_URI, GET_METHOD, null));
assertFalse(AIS_GET_SCA_STATUS.check(AIS_SCA_URI, FLAWED_METHOD, null));
}
@Test
void aisGetConsentStatus() {
assertTrue(AIS_GET_CONSENT_STATUS.check(CONSENT_STATUS_URI, GET_METHOD, null));
assertFalse(AIS_GET_CONSENT_STATUS.check(FLAWED_URI, GET_METHOD, null));
assertFalse(AIS_GET_CONSENT_STATUS.check(CONSENT_STATUS_URI, FLAWED_METHOD, null));
}
@Test
void pisPaymentsSctInitiatePayments() {
assertTrue(PIS_PAYMENTS_SCT_INITIATE_PAYMENT.check(PAYMENTS_SCT_URI, POST_METHOD, null));
assertFalse(PIS_PAYMENTS_SCT_INITIATE_PAYMENT.check(FLAWED_URI, POST_METHOD, null));
assertFalse(PIS_PAYMENTS_SCT_INITIATE_PAYMENT.check(PAYMENTS_SCT_URI, FLAWED_METHOD, null));
}
@Test
void pisPaymentsPain001SctInitiatePayments() {
assertTrue(PIS_PAYMENTS_PAIN001_SCT_INITIATE_PAYMENT.check(PAYMENTS_PAIN001_SCT_URI, POST_METHOD, null));
assertFalse(PIS_PAYMENTS_PAIN001_SCT_INITIATE_PAYMENT.check(FLAWED_URI, POST_METHOD, null));
assertFalse(PIS_PAYMENTS_PAIN001_SCT_INITIATE_PAYMENT.check(PAYMENTS_PAIN001_SCT_URI, FLAWED_METHOD, null));
}
@Test
void pisPeriodicSctInitiatePayments() {
assertTrue(PIS_PERIODIC_SCT_INITIATE_PAYMENT.check(PERIODIC_SCT_URI, POST_METHOD, null));
assertFalse(PIS_PERIODIC_SCT_INITIATE_PAYMENT.check(FLAWED_URI, POST_METHOD, null));
assertFalse(PIS_PERIODIC_SCT_INITIATE_PAYMENT.check(PERIODIC_SCT_URI, FLAWED_METHOD, null));
}
@Test
void pisPeriodicPain001SctInitiatePayments() {
assertTrue(PIS_PERIODIC_PAIN001_SCT_INITIATE_PAYMENT.check(PERIODIC_PAIN001_CST_URI, POST_METHOD, null));
assertFalse(PIS_PERIODIC_PAIN001_SCT_INITIATE_PAYMENT.check(FLAWED_URI, POST_METHOD, null));
assertFalse(PIS_PERIODIC_PAIN001_SCT_INITIATE_PAYMENT.check(PERIODIC_PAIN001_CST_URI, FLAWED_METHOD, null));
}
@Test
void pisPaymentsSctStartPsuAuthentication() {
assertTrue(PIS_PAYMENTS_SCT_START_PSU_AUTHENTICATION.check(PAYMENTS_SCT_AUTHORISATIONS_URI, POST_METHOD, null));
assertFalse(PIS_PAYMENTS_SCT_START_PSU_AUTHENTICATION.check(FLAWED_URI, POST_METHOD, null));
assertFalse(PIS_PAYMENTS_SCT_START_PSU_AUTHENTICATION.check(PAYMENTS_SCT_AUTHORISATIONS_URI, FLAWED_METHOD, null));
}
@Test
void pisPaymentsPain001SctStartPsuAuthentication() {
assertTrue(PIS_PAYMENTS_PAIN001_SCT_START_PSU_AUTHENTICATION.check(PAYMENTS_PAIN001_SCT_AUTHORISATIONS_URI, POST_METHOD, null));
assertFalse(PIS_PAYMENTS_PAIN001_SCT_START_PSU_AUTHENTICATION.check(FLAWED_URI, POST_METHOD, null));
assertFalse(PIS_PAYMENTS_PAIN001_SCT_START_PSU_AUTHENTICATION.check(PAYMENTS_PAIN001_SCT_AUTHORISATIONS_URI, FLAWED_METHOD, null));
}
@Test
void pisPeriodicSctStartPsuAuthentication() {
assertTrue(PIS_PERIODIC_SCT_START_PSU_AUTHENTICATION.check(PERIODIC_SCT_AUTHORISATIONS_URI, POST_METHOD, null));
assertFalse(PIS_PERIODIC_SCT_START_PSU_AUTHENTICATION.check(FLAWED_URI, POST_METHOD, null));
assertFalse(PIS_PERIODIC_SCT_START_PSU_AUTHENTICATION.check(PERIODIC_SCT_AUTHORISATIONS_URI, FLAWED_METHOD, null));
}
@Test
void pisPeriodicPain001SctStartPsuAuthentication() {
assertTrue(PIS_PERIODIC_PAIN001_SCT_START_PSU_AUTHENTICATION.check(PERIODIC_PAIN001_SCT_AUTHORISATIONS_URI, POST_METHOD, null));
assertFalse(PIS_PERIODIC_PAIN001_SCT_START_PSU_AUTHENTICATION.check(FLAWED_URI, POST_METHOD, null));
assertFalse(PIS_PERIODIC_PAIN001_SCT_START_PSU_AUTHENTICATION.check(PERIODIC_PAIN001_SCT_AUTHORISATIONS_URI, FLAWED_METHOD, null));
}
@Test
void pisPaymentsSctUpdatePsuAuthentication() {
assertTrue(PIS_PAYMENTS_SCT_UPDATE_PSU_AUTHENTICATION.check(PAYMENTS_SCT_URI, PUT_METHOD, PSU_DATA_BODY));
assertFalse(PIS_PAYMENTS_SCT_UPDATE_PSU_AUTHENTICATION.check(FLAWED_URI, PUT_METHOD, PSU_DATA_BODY));
assertFalse(PIS_PAYMENTS_SCT_UPDATE_PSU_AUTHENTICATION.check(PAYMENTS_SCT_URI, FLAWED_METHOD, PSU_DATA_BODY));
assertFalse(PIS_PAYMENTS_SCT_UPDATE_PSU_AUTHENTICATION.check(PAYMENTS_SCT_URI, PUT_METHOD, FLAWED_BODY));
}
@Test
void pisPaymentsPain001SctUpdatePsuAuthentication() {
assertTrue(PIS_PAYMENTS_PAIN001_SCT_UPDATE_PSU_AUTHENTICATION.check(PAYMENTS_PAIN001_SCT_URI, PUT_METHOD, PSU_DATA_BODY));
assertFalse(PIS_PAYMENTS_PAIN001_SCT_UPDATE_PSU_AUTHENTICATION.check(FLAWED_URI, PUT_METHOD, PSU_DATA_BODY));
assertFalse(PIS_PAYMENTS_PAIN001_SCT_UPDATE_PSU_AUTHENTICATION.check(PAYMENTS_PAIN001_SCT_URI, FLAWED_METHOD, PSU_DATA_BODY));
assertFalse(PIS_PAYMENTS_PAIN001_SCT_UPDATE_PSU_AUTHENTICATION.check(PAYMENTS_PAIN001_SCT_URI, PUT_METHOD, FLAWED_BODY));
}
@Test
void pisPeriodicSctUpdatePsuAuthentication() {
assertTrue(PIS_PERIODIC_SCT_UPDATE_PSU_AUTHENTICATION.check(PERIODIC_SCT_URI, PUT_METHOD, PSU_DATA_BODY));
assertFalse(PIS_PERIODIC_SCT_UPDATE_PSU_AUTHENTICATION.check(FLAWED_URI, PUT_METHOD, PSU_DATA_BODY));
assertFalse(PIS_PERIODIC_SCT_UPDATE_PSU_AUTHENTICATION.check(PERIODIC_SCT_URI, FLAWED_METHOD, PSU_DATA_BODY));
assertFalse(PIS_PERIODIC_SCT_UPDATE_PSU_AUTHENTICATION.check(PERIODIC_SCT_URI, PUT_METHOD, FLAWED_BODY));
}
@Test
void pisPeriodicPain001SctUpdatePsuAuthentication() {
assertTrue(PIS_PERIODIC_PAIN001_SCT_UPDATE_PSU_AUTHENTICATION.check(PERIODIC_PAIN001_CST_URI, PUT_METHOD, PSU_DATA_BODY));
assertFalse(PIS_PERIODIC_PAIN001_SCT_UPDATE_PSU_AUTHENTICATION.check(FLAWED_URI, PUT_METHOD, PSU_DATA_BODY));
assertFalse(PIS_PERIODIC_PAIN001_SCT_UPDATE_PSU_AUTHENTICATION.check(PERIODIC_PAIN001_CST_URI, FLAWED_METHOD, PSU_DATA_BODY));
assertFalse(PIS_PERIODIC_PAIN001_SCT_UPDATE_PSU_AUTHENTICATION.check(PERIODIC_PAIN001_CST_URI, PUT_METHOD, FLAWED_BODY));
}
@Test
void pisPaymentsSctSelectScaMethod() {
assertTrue(PIS_PAYMENTS_SCT_SELECT_SCA_METHOD.check(PAYMENTS_SCT_URI, PUT_METHOD, AUTHENTICATION_METHOD_ID_BODY));
assertFalse(PIS_PAYMENTS_SCT_SELECT_SCA_METHOD.check(FLAWED_URI, PUT_METHOD, AUTHENTICATION_METHOD_ID_BODY));
assertFalse(PIS_PAYMENTS_SCT_SELECT_SCA_METHOD.check(PAYMENTS_SCT_URI, FLAWED_METHOD, AUTHENTICATION_METHOD_ID_BODY));
assertFalse(PIS_PAYMENTS_SCT_SELECT_SCA_METHOD.check(PAYMENTS_SCT_URI, PUT_METHOD, FLAWED_BODY));
}
@Test
void pisPaymentsPain001SctSelectScaMethod() {
assertTrue(PIS_PAYMENTS_PAIN001_SCT_SELECT_SCA_METHOD.check(PAYMENTS_PAIN001_SCT_URI, PUT_METHOD, AUTHENTICATION_METHOD_ID_BODY));
assertFalse(PIS_PAYMENTS_PAIN001_SCT_SELECT_SCA_METHOD.check(FLAWED_URI, PUT_METHOD, AUTHENTICATION_METHOD_ID_BODY));
assertFalse(PIS_PAYMENTS_PAIN001_SCT_SELECT_SCA_METHOD.check(PAYMENTS_PAIN001_SCT_URI, FLAWED_METHOD, AUTHENTICATION_METHOD_ID_BODY));
assertFalse(PIS_PAYMENTS_PAIN001_SCT_SELECT_SCA_METHOD.check(PAYMENTS_PAIN001_SCT_URI, PUT_METHOD, FLAWED_BODY));
}
@Test
void pisPeriodicSctSelectScaMethod() {
assertTrue(PIS_PERIODIC_SCT_SELECT_SCA_METHOD.check(PERIODIC_SCT_URI, PUT_METHOD, AUTHENTICATION_METHOD_ID_BODY));
assertFalse(PIS_PERIODIC_SCT_SELECT_SCA_METHOD.check(FLAWED_URI, PUT_METHOD, AUTHENTICATION_METHOD_ID_BODY));
assertFalse(PIS_PERIODIC_SCT_SELECT_SCA_METHOD.check(PERIODIC_SCT_URI, FLAWED_METHOD, AUTHENTICATION_METHOD_ID_BODY));
assertFalse(PIS_PERIODIC_SCT_SELECT_SCA_METHOD.check(PERIODIC_SCT_URI, PUT_METHOD, FLAWED_BODY));
}
@Test
void pisPeriodicsPain001SctSelectScaMethod() {
assertTrue(PIS_PERIODIC_PAIN001_SCT_SELECT_SCA_METHOD.check(PERIODIC_PAIN001_CST_URI, PUT_METHOD, AUTHENTICATION_METHOD_ID_BODY));
assertFalse(PIS_PERIODIC_PAIN001_SCT_SELECT_SCA_METHOD.check(FLAWED_URI, PUT_METHOD, AUTHENTICATION_METHOD_ID_BODY));
assertFalse(PIS_PERIODIC_PAIN001_SCT_SELECT_SCA_METHOD.check(PERIODIC_PAIN001_CST_URI, FLAWED_METHOD, AUTHENTICATION_METHOD_ID_BODY));
assertFalse(PIS_PERIODIC_PAIN001_SCT_SELECT_SCA_METHOD.check(PERIODIC_PAIN001_CST_URI, PUT_METHOD, FLAWED_BODY));
}
@Test
void pisPaymentsScaSendOtp() {
assertTrue(PIS_PAYMENTS_SCT_SEND_OTP.check(PAYMENTS_SCT_URI, PUT_METHOD, SCA_AUTHENTICATION_DATA_BODY));
assertFalse(PIS_PAYMENTS_SCT_SEND_OTP.check(FLAWED_URI, PUT_METHOD, SCA_AUTHENTICATION_DATA_BODY));
assertFalse(PIS_PAYMENTS_SCT_SEND_OTP.check(PAYMENTS_SCT_URI, FLAWED_METHOD, SCA_AUTHENTICATION_DATA_BODY));
assertFalse(PIS_PAYMENTS_SCT_SEND_OTP.check(PAYMENTS_SCT_URI, PUT_METHOD, FLAWED_BODY));
}
@Test
void pisPaymentsPain001ScaSendOtp() {
assertTrue(PIS_PAYMENTS_PAIN001_SCT_SEND_OTP.check(PAYMENTS_PAIN001_SCT_URI, PUT_METHOD, SCA_AUTHENTICATION_DATA_BODY));
assertFalse(PIS_PAYMENTS_PAIN001_SCT_SEND_OTP.check(FLAWED_URI, PUT_METHOD, SCA_AUTHENTICATION_DATA_BODY));
assertFalse(PIS_PAYMENTS_PAIN001_SCT_SEND_OTP.check(PAYMENTS_PAIN001_SCT_URI, FLAWED_METHOD, SCA_AUTHENTICATION_DATA_BODY));
assertFalse(PIS_PAYMENTS_PAIN001_SCT_SEND_OTP.check(PAYMENTS_PAIN001_SCT_URI, PUT_METHOD, FLAWED_BODY));
}
@Test
void pisPeriodicScaSendOtp() {
assertTrue(PIS_PERIODIC_SCT_SEND_OTP.check(PERIODIC_SCT_URI, PUT_METHOD, SCA_AUTHENTICATION_DATA_BODY));
assertFalse(PIS_PERIODIC_SCT_SEND_OTP.check(FLAWED_URI, PUT_METHOD, SCA_AUTHENTICATION_DATA_BODY));
assertFalse(PIS_PERIODIC_SCT_SEND_OTP.check(PERIODIC_SCT_URI, FLAWED_METHOD, SCA_AUTHENTICATION_DATA_BODY));
assertFalse(PIS_PERIODIC_SCT_SEND_OTP.check(PERIODIC_SCT_URI, PUT_METHOD, FLAWED_BODY));
}
@Test
void pisPeriodicPain001ScaSendOtp() {
assertTrue(PIS_PERIODIC_PAIN001_SCT_SEND_OTP.check(PERIODIC_PAIN001_CST_URI, PUT_METHOD, SCA_AUTHENTICATION_DATA_BODY));
assertFalse(PIS_PERIODIC_PAIN001_SCT_SEND_OTP.check(FLAWED_URI, PUT_METHOD, SCA_AUTHENTICATION_DATA_BODY));
assertFalse(PIS_PERIODIC_PAIN001_SCT_SEND_OTP.check(PERIODIC_PAIN001_CST_URI, FLAWED_METHOD, SCA_AUTHENTICATION_DATA_BODY));
assertFalse(PIS_PERIODIC_PAIN001_SCT_SEND_OTP.check(PERIODIC_PAIN001_CST_URI, PUT_METHOD, FLAWED_BODY));
}
@Test
void pisPaymentsSctGetTransactionStatus() {
assertTrue(PIS_PAYMENTS_SCT_GET_TRANSACTION_STATUS.check(PAYMENTS_SCT_PAYMENT_STATUS_URI, GET_METHOD, null));
assertFalse(PIS_PAYMENTS_SCT_GET_TRANSACTION_STATUS.check(FLAWED_URI, GET_METHOD, null));
assertFalse(PIS_PAYMENTS_SCT_GET_TRANSACTION_STATUS.check(PAYMENTS_SCT_PAYMENT_STATUS_URI, FLAWED_METHOD, null));
}
@Test
void pisPaymentsPain001SctGetTransactionStatus() {
assertTrue(PIS_PAYMENTS_PAIN001_SCT_GET_TRANSACTION_STATUS.check(PAYMENTS_PAIN001_SCT_PAYMENT_STATUS_URI, GET_METHOD, null));
assertFalse(PIS_PAYMENTS_PAIN001_SCT_GET_TRANSACTION_STATUS.check(FLAWED_URI, GET_METHOD, null));
assertFalse(PIS_PAYMENTS_PAIN001_SCT_GET_TRANSACTION_STATUS.check(PAYMENTS_PAIN001_SCT_PAYMENT_STATUS_URI, FLAWED_METHOD, null));
}
@Test
void pisPeriodicSctGetTransactionStatus() {
assertTrue(PIS_PERIODIC_SCT_GET_TRANSACTION_STATUS.check(PERIODIC_SCT_PAYMENT_STATUS_URI, GET_METHOD, null));
assertFalse(PIS_PERIODIC_SCT_GET_TRANSACTION_STATUS.check(FLAWED_URI, GET_METHOD, null));
assertFalse(PIS_PERIODIC_SCT_GET_TRANSACTION_STATUS.check(PERIODIC_SCT_PAYMENT_STATUS_URI, FLAWED_METHOD, null));
}
@Test
void pisPeriodicPain001SctGetTransactionStatus() {
assertTrue(PIS_PERIODIC_PAIN001_SCT_GET_TRANSACTION_STATUS.check(PERIODIC_PAIN001_SCT_PAYMENT_STATUS_URI, GET_METHOD, null));
assertFalse(PIS_PERIODIC_PAIN001_SCT_GET_TRANSACTION_STATUS.check(FLAWED_URI, GET_METHOD, null));
assertFalse(PIS_PERIODIC_PAIN001_SCT_GET_TRANSACTION_STATUS.check(PERIODIC_PAIN001_SCT_PAYMENT_STATUS_URI, FLAWED_METHOD, null));
}
@Test
void pisPaymentsSctGetScaStatus() {
assertTrue(PIS_PAYMENTS_SCT_GET_SCA_STATUS.check(PAYMENTS_SCT_SCA_STATUS_URI, GET_METHOD, null));
assertFalse(PIS_PAYMENTS_SCT_GET_SCA_STATUS.check(FLAWED_URI, GET_METHOD, null));
assertFalse(PIS_PAYMENTS_SCT_GET_SCA_STATUS.check(PAYMENTS_SCT_SCA_STATUS_URI, FLAWED_METHOD, null));
}
@Test
void pisPaymentsPain001SctGetScaStatus() {
assertTrue(PIS_PAYMENTS_PAIN001_SCT_GET_SCA_STATUS.check(PAYMENTS_PAIN001_SCT_SCA_STATUS_URI, GET_METHOD, null));
assertFalse(PIS_PAYMENTS_PAIN001_SCT_GET_SCA_STATUS.check(FLAWED_URI, GET_METHOD, null));
assertFalse(PIS_PAYMENTS_PAIN001_SCT_GET_SCA_STATUS.check(PAYMENTS_PAIN001_SCT_SCA_STATUS_URI, FLAWED_METHOD, null));
}
@Test
void pisPeriodicSctGetScaStatus() {
assertTrue(PIS_PERIODIC_SCT_GET_SCA_STATUS.check(PERIODIC_SCT_SCA_STATUS_URI, GET_METHOD, null));
assertFalse(PIS_PERIODIC_SCT_GET_SCA_STATUS.check(FLAWED_URI, GET_METHOD, null));
assertFalse(PIS_PERIODIC_SCT_GET_SCA_STATUS.check(PERIODIC_SCT_SCA_STATUS_URI, FLAWED_METHOD, null));
}
@Test
void pisPeriodicPain001SctGetScaStatus() {
assertTrue(PIS_PERIODIC_PAIN001_SCT_GET_SCA_STATUS.check(PERIODIC_PAIN001_SCT_SCA_STATUS_URI, GET_METHOD, null));
assertFalse(PIS_PERIODIC_PAIN001_SCT_GET_SCA_STATUS.check(FLAWED_URI, GET_METHOD, null));
assertFalse(PIS_PERIODIC_PAIN001_SCT_GET_SCA_STATUS.check(PERIODIC_PAIN001_SCT_SCA_STATUS_URI, FLAWED_METHOD, null));
}
@Test
void resolve_throwException() {
assertThrows(IllegalStateException.class, () -> WiremockFileType.resolve(FLAWED_URI, FLAWED_METHOD, FLAWED_BODY));
}
}
| 20,931 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
FlatMapUtilsTest.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/test/java/de/adorsys/xs2a/adapter/impl/http/wiremock/FlatMapUtilsTest.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl.http.wiremock;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.Test;
import java.util.Map;
import static org.assertj.core.api.Assertions.assertThat;
class FlatMapUtilsTest {
@Test
void flatten() throws JsonProcessingException {
String json = "{\"a\":1, \"b\":{\"b1\":2,\"b2\":3},\"c\":[{\"d\":4},5]}";
Map<String, Object> actualMap = (Map<String, Object>) FlatMapUtils.flatten(new ObjectMapper().readValue(json, Map.class));
assertThat(actualMap)
.hasSize(5)
.containsKeys("/a", "/b/b1", "/b/b2", "/c/0/d", "/c/1")
.containsValues(1, 2, 3, 4, 5);
}
}
| 1,587 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
TestInstancesSupplier.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/test/java/de/adorsys/xs2a/adapter/impl/http/wiremock/TestInstancesSupplier.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl.http.wiremock;
import de.adorsys.xs2a.adapter.api.Response;
import de.adorsys.xs2a.adapter.api.ResponseHeaders;
import de.adorsys.xs2a.adapter.api.model.*;
import java.time.LocalDate;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import static java.util.Collections.singletonList;
public class TestInstancesSupplier {
private static final String IBAN = "IBAN";
private static final String CURRENCY = "EUR";
private static final HrefType HREF_TYPE = getHrefType();
public static Aspsp getAspsp() {
Aspsp aspsp = new Aspsp();
aspsp.setAdapterId("adorsys-adapter");
return aspsp;
}
public static AccountList getAccountList() {
AccountList accountList = new AccountList();
accountList.setAccounts(Collections.singletonList(getAccountDetails()));
return accountList;
}
private static AccountDetails getAccountDetails() {
AccountDetails details = new AccountDetails();
details.setResourceId("some_value");
details.setIban(IBAN);
details.setCurrency(CURRENCY);
details.setName("user");
details.setDisplayName("display user");
details.setProduct("product");
details.setCashAccountType("CASH");
details.setStatus(AccountStatus.ENABLED);
details.setLinkedAccounts("linked_account");
details.setUsage(AccountDetails.Usage.PRIV);
details.setLinks(getLinks("balances", "transactions"));
return details;
}
private static Map<String, HrefType> getLinks(String... args) {
if (args.length == 0) {
return new HashMap<>();
}
Map<String, HrefType> links = new HashMap<>();
for (String arg : args) {
links.put(arg, HREF_TYPE);
}
return links;
}
private static HrefType getHrefType() {
HrefType hrefType = new HrefType();
hrefType.setHref("http://foo.boo");
return hrefType;
}
public static Consents getConsents() {
Consents requestBody = new Consents();
requestBody.setAccess(getAccess());
requestBody.setCombinedServiceIndicator(false);
requestBody.setRecurringIndicator(true);
requestBody.setValidUntil(LocalDate.now());
requestBody.setFrequencyPerDay(4);
return requestBody;
}
private static AccountAccess getAccess() {
AccountAccess accountAccess = new AccountAccess();
accountAccess.setAccounts(singletonList(getAccountReference()));
accountAccess.setBalances(singletonList(getAccountReference()));
accountAccess.setTransactions(singletonList(getAccountReference()));
return accountAccess;
}
private static AccountReference getAccountReference() {
AccountReference accountReference = new AccountReference();
accountReference.setIban(IBAN);
accountReference.setCurrency(CURRENCY);
return accountReference;
}
public static ConsentsResponse201 getConsentResponse201() {
ConsentsResponse201 consentsResponse = new ConsentsResponse201();
consentsResponse.setConsentStatus(ConsentStatus.RECEIVED);
consentsResponse.setConsentId("consent-id");
consentsResponse.setLinks(getLinks("updatePsuAuthentication", "self", "status", "scaStatus"));
return consentsResponse;
}
public static PaymentInitationRequestResponse201 getPaymentInitiationRequestResponse201() {
PaymentInitationRequestResponse201 response = new PaymentInitationRequestResponse201();
response.setTransactionStatus(TransactionStatus.RCVD);
response.setPaymentId("foo");
response.setLinks(getLinks("updatePsuAuthentication", "self", "status", "scaStatus"));
return response;
}
public static ResponseHeaders getResponseHeaders(String key, String value) {
Map<String, String> headers = new HashMap<>();
headers.put(key, value);
return ResponseHeaders.fromMap(headers);
}
public static <T> Response<T> getResponse(T body) {
return getResponse(body, ResponseHeaders.emptyResponseHeaders());
}
public static <T> Response<T> getResponse(T body, ResponseHeaders responseHeaders) {
return new Response<>(200, body, responseHeaders);
}
public static PeriodicPaymentInitiationXmlPart2StandingorderTypeJson getPeriodicPaymentInitiationXmlPart2StandingorderTypeJson() {
PeriodicPaymentInitiationXmlPart2StandingorderTypeJson response
= new PeriodicPaymentInitiationXmlPart2StandingorderTypeJson();
response.setStartDate(LocalDate.now());
response.setEndDate(LocalDate.now());
response.setFrequency(FrequencyCode.WEEKLY);
response.setDayOfExecution(DayOfExecution._1);
return response;
}
}
| 5,713 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
IdentityLinksRewriterTest.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/test/java/de/adorsys/xs2a/adapter/impl/link/identity/IdentityLinksRewriterTest.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl.link.identity;
import de.adorsys.xs2a.adapter.api.link.LinksRewriter;
import de.adorsys.xs2a.adapter.api.model.HrefType;
import org.junit.jupiter.api.Test;
import java.util.HashMap;
import java.util.Map;
import static org.assertj.core.api.Assertions.assertThat;
class IdentityLinksRewriterTest {
private LinksRewriter linksRewriter = new IdentityLinksRewriter();
@Test
void rewrite() {
Map<String, HrefType> links = new HashMap<>();
HrefType scaStatus = new HrefType();
scaStatus.setHref("http://example.com/sca/status");
links.put("scaStatus", scaStatus);
HrefType self = new HrefType();
self.setHref("http://example.com/self");
links.put("self", self);
Map<String, HrefType> rewrittenLinks = linksRewriter.rewrite(links);
assertThat(rewrittenLinks).isEqualTo(links);
}
@Test
void rewrite_emptyLinks() {
Map<String, HrefType> links = new HashMap<>();
Map<String, HrefType> rewrittenLinks = linksRewriter.rewrite(links);
assertThat(rewrittenLinks).isEqualTo(links);
}
@Test
void rewrite_nullLinks() {
assertThat(linksRewriter.rewrite(null)).isNull();
}
}
| 2,077 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
BerlinGroupLinksRewriterTest.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/test/java/de/adorsys/xs2a/adapter/impl/link/bg/BerlinGroupLinksRewriterTest.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl.link.bg;
import de.adorsys.xs2a.adapter.impl.link.bg.template.LinksTemplate;
import de.adorsys.xs2a.adapter.api.model.HrefType;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.when;
@ExtendWith(MockitoExtension.class)
class BerlinGroupLinksRewriterTest {
private static final String HOST = "https://example.com";
private static final String VERSION = "v1";
private static final String CONSENT_ID = UUID.randomUUID().toString();
private static final String AUTHORISATION_ID = UUID.randomUUID().toString();
private static final String TRANSACTION_ID = UUID.randomUUID().toString();
private static final String ACCOUNT_ID = UUID.randomUUID().toString();
private static final String PAYMENT_SERVICE = "payments";
private static final String PAYMENT_PRODUCT = "sepa-credit-transfers";
private static final String PAYMENT_ID = UUID.randomUUID().toString();
@Mock
private LinksTemplate linksTemplate;
private BerlinGroupLinksRewriter berlinGroupLinksRewriter;
@BeforeEach
void setUp() {
berlinGroupLinksRewriter = new BerlinGroupLinksRewriter(linksTemplate, HOST, VERSION);
}
@Test
void rewrite_failure_linksAreEmpty() {
Map<String, HrefType> links = new HashMap<>();
Map<String, HrefType> rewrittenLinks = berlinGroupLinksRewriter.rewrite(links);
assertThat(rewrittenLinks).isEmpty();
}
@Test
void rewrite_failure_linksAreNull() {
Map<String, HrefType> rewrittenLinks = berlinGroupLinksRewriter.rewrite(null);
assertThat(rewrittenLinks).isNull();
}
@Test
void rewrite_failure_linksAreUnchangeable() {
String unchangeableLinkName1 = "scaRedirect";
HrefType unchangeableLink1 = new HrefType();
unchangeableLink1.setHref("https://example.com/1");
String unchangeableLinkName2 = "scaOAuth";
HrefType unchangeableLink2 = new HrefType();
unchangeableLink2.setHref("https://example.com/2");
berlinGroupLinksRewriter = new BerlinGroupLinksRewriter(linksTemplate, HOST, VERSION) {
@Override
protected boolean linkUnchangeable(String linkName) {
return unchangeableLinkName1.equals(linkName) || unchangeableLinkName2.equals(linkName);
}
};
Map<String, HrefType> links = new HashMap<>();
links.put(unchangeableLinkName1, unchangeableLink1);
links.put(unchangeableLinkName2, unchangeableLink2);
Map<String, HrefType> rewrittenLinks = berlinGroupLinksRewriter.rewrite(links);
assertThat(rewrittenLinks).hasSize(links.size())
.containsEntry(unchangeableLinkName1, unchangeableLink1)
.containsEntry(unchangeableLinkName2, unchangeableLink2);
}
@Test
void rewrite_failure_linksAreUnknown() {
String unknownLinkName = "unknown";
HrefType unknownLink = new HrefType();
unknownLink.setHref("https://example.com/");
Map<String, HrefType> links = new HashMap<>();
links.put(unknownLinkName, unknownLink);
when(linksTemplate.get(unknownLinkName)).thenReturn(Optional.empty());
Map<String, HrefType> rewrittenLinks = berlinGroupLinksRewriter.rewrite(links);
assertThat(rewrittenLinks).hasSize(links.size())
.containsEntry(unknownLinkName, unknownLink);
}
@Test
void rewrite_failure_noParamRetrieverForLinkTemplatePlaceholder() {
String linkName = "linkName";
HrefType link = new HrefType();
link.setHref("https://example.com/");
String template = "{host}/{unknown}";
Map<String, HrefType> links = new HashMap<>();
links.put(linkName, link);
when(linksTemplate.get(linkName)).thenReturn(Optional.of(template));
Map<String, HrefType> rewrittenLinks = berlinGroupLinksRewriter.rewrite(links);
assertThat(rewrittenLinks).hasSize(links.size())
.containsEntry(linkName, link);
}
@Test
void rewrite_failure_emptyValueForPlaceholder() {
String linkName = "linkName";
HrefType link = new HrefType();
link.setHref("https://example.com/v2/consents");
String template = "{host}/{version}/consents/{consentId}";
Map<String, HrefType> links = new HashMap<>();
links.put(linkName, link);
when(linksTemplate.get(linkName)).thenReturn(Optional.of(template));
Map<String, HrefType> rewrittenLinks = berlinGroupLinksRewriter.rewrite(links);
assertThat(rewrittenLinks).hasSize(links.size())
.containsEntry(linkName, link);
}
@Test
void rewrite_success() {
String linkName1 = "linkName1";
String linkHref1 = String.format(
"https://adorsys.de/api/v42/consents/%s/authorisations/%s/transactions/%s",
CONSENT_ID, AUTHORISATION_ID, TRANSACTION_ID
);
HrefType link1 = new HrefType();
link1.setHref(linkHref1);
String template1 = "{host}/{version}/consents/{consentId}/authorisations/{authorisationId}/transactions/{transactionId}";
HrefType expectedRewrittenLink1 = new HrefType();
expectedRewrittenLink1.setHref(String.format("%s/%s/consents/%s/authorisations/%s/transactions/%s",
HOST, VERSION, CONSENT_ID, AUTHORISATION_ID, TRANSACTION_ID));
String linkName2 = "linkName2";
String linkHref2 = String.format(
"https://adorsys.de/api/v42/%s/%s/%s",
PAYMENT_SERVICE, PAYMENT_PRODUCT, PAYMENT_ID
);
HrefType link2 = new HrefType();
link2.setHref(linkHref2);
String template2 = "{host}/{version}/{paymentService}/{paymentProduct}/{paymentId}";
HrefType expectedRewrittenLink2 = new HrefType();
expectedRewrittenLink2.setHref(String.format("%s/%s/%s/%s/%s",
HOST, VERSION, PAYMENT_SERVICE, PAYMENT_PRODUCT, PAYMENT_ID));
Map<String, HrefType> links = new HashMap<>();
links.put(linkName1, link1);
links.put(linkName2, link2);
when(linksTemplate.get(linkName1)).thenReturn(Optional.of(template1));
when(linksTemplate.get(linkName2)).thenReturn(Optional.of(template2));
Map<String, HrefType> rewrittenLinks = berlinGroupLinksRewriter.rewrite(links);
assertThat(rewrittenLinks).hasSize(links.size())
.containsKeys(linkName1, linkName2);
assertThat(rewrittenLinks.get(linkName1).getHref()).isEqualTo(expectedRewrittenLink1.getHref());
assertThat(rewrittenLinks.get(linkName2).getHref()).isEqualTo(expectedRewrittenLink2.getHref());
}
@Test
void rewrite_success_registerNewPlaceholder() {
String newPlaceholder = "{newPlaceholder}";
String newPlaceholderParamValue = UUID.randomUUID().toString();
String linkName = "linkName1";
String linkHref = String.format(
"https://adorsys.de/api/v42/consents/%s/%s",
CONSENT_ID, newPlaceholderParamValue
);
HrefType link = new HrefType();
link.setHref(linkHref);
String template = "{host}/{version}/consents/{consentId}/" + newPlaceholder;
HrefType expectedRewrittenLink = new HrefType();
expectedRewrittenLink.setHref(String.format("%s/%s/consents/%s/%s",
HOST, VERSION, CONSENT_ID, newPlaceholderParamValue));
Map<String, HrefType> links = new HashMap<>();
links.put(linkName, link);
when(linksTemplate.get(linkName)).thenReturn(Optional.of(template));
berlinGroupLinksRewriter.registerPlaceholder(newPlaceholder, l -> Optional.of(newPlaceholderParamValue));
Map<String, HrefType> rewrittenLinks = berlinGroupLinksRewriter.rewrite(links);
assertThat(rewrittenLinks).hasSize(links.size())
.containsKey(linkName);
assertThat(rewrittenLinks.get(linkName).getHref()).isEqualTo(expectedRewrittenLink.getHref());
}
@Test
void retrieveHost_success_existsInLink() {
assertThat(berlinGroupLinksRewriter.retrieveHost("https://example.com"))
.isEqualTo(Optional.of(HOST));
}
@Test
void retrieveHost_failure_notExistsInLink() {
assertThat(berlinGroupLinksRewriter.retrieveHost("anylink"))
.isEqualTo(Optional.of(HOST));
}
@Test
void retrieveVersion_success_existsInLink() {
assertThat(berlinGroupLinksRewriter.retrieveVersion("https://example.com/v42"))
.isEqualTo(Optional.of(VERSION));
}
@Test
void retrieveVersion_failure_notExistsInLink() {
assertThat(berlinGroupLinksRewriter.retrieveVersion("anylink"))
.isEqualTo(Optional.of(VERSION));
}
@Test
void retrieveConsentId_success_existsInLink() {
String link = "https://example.com/consents/" + CONSENT_ID;
Optional<String> actualConsentIdOptional = berlinGroupLinksRewriter.retrieveConsentId(link);
assertThat(actualConsentIdOptional).contains(CONSENT_ID);
}
@Test
void retrieveConsentId_failure_notExistsInLink() {
String link = "https://example.com/consents/";
Optional<String> actualConsentIdOptional = berlinGroupLinksRewriter.retrieveConsentId(link);
assertThat(actualConsentIdOptional).isNotPresent();
}
@Test
void retrieveAuthorisationId_success_existsInLink() {
String link = "https://example.com/authorisations/" + AUTHORISATION_ID;
Optional<String> actualAuthorisationIdOptional = berlinGroupLinksRewriter.retrieveAuthorisationId(link);
assertThat(actualAuthorisationIdOptional).contains(AUTHORISATION_ID);
}
@Test
void retrieveAuthorisationId_failure_notExistsInLink() {
String link = "https://example.com/authorisations/";
Optional<String> actualAuthorisationIdOptional = berlinGroupLinksRewriter.retrieveAuthorisationId(link);
assertThat(actualAuthorisationIdOptional).isNotPresent();
}
@Test
void retrieveAccountId_success_existsInLink() {
String link = "https://example.com/accounts/" + ACCOUNT_ID;
Optional<String> actualAccountIdOptional = berlinGroupLinksRewriter.retrieveAccountId(link);
assertThat(actualAccountIdOptional).contains(ACCOUNT_ID);
}
@Test
void retrieveAccountId_failure_notExistsInLink() {
String link = "https://example.com/accounts/";
Optional<String> actualAccountIdOptional = berlinGroupLinksRewriter.retrieveAccountId(link);
assertThat(actualAccountIdOptional).isNotPresent();
}
@Test
void retrieveTransactionId_success_existsInLink() {
String link = "https://example.com/transactions/" + TRANSACTION_ID;
Optional<String> actualTransactionIdOptional = berlinGroupLinksRewriter.retrieveTransactionId(link);
assertThat(actualTransactionIdOptional).contains(TRANSACTION_ID);
}
@Test
void retrieveTransactionId_failure_notExistsInLink() {
String link = "https://example.com/transactions/";
Optional<String> actualTransactionIdOptional = berlinGroupLinksRewriter.retrieveTransactionId(link);
assertThat(actualTransactionIdOptional).isNotPresent();
}
@Test
void retrievePaymentService_success_existsInLink() {
String link = "https://example.com/v1/" + PAYMENT_SERVICE;
Optional<String> actualPaymentServiceOptional = berlinGroupLinksRewriter.retrievePaymentService(link);
assertThat(actualPaymentServiceOptional).contains(PAYMENT_SERVICE);
}
@Test
void retrievePaymentService_failure_notExistsInLink() {
String link = "https://example.com/v1/";
Optional<String> actualPaymentServiceOptional = berlinGroupLinksRewriter.retrievePaymentService(link);
assertThat(actualPaymentServiceOptional).isNotPresent();
}
@Test
void retrievePaymentProduct_success_existsInLink() {
String link = String.format(
"https://example.com/v1/%s/%s",
PAYMENT_SERVICE, PAYMENT_PRODUCT
);
Optional<String> actualPaymentProductOptional = berlinGroupLinksRewriter.retrievePaymentProduct(link);
assertThat(actualPaymentProductOptional).contains(PAYMENT_PRODUCT);
}
@Test
void retrievePaymentProduct_failure_notExistsInLink() {
String link = "https://example.com/v1/";
Optional<String> actualPaymentProductOptional = berlinGroupLinksRewriter.retrievePaymentProduct(link);
assertThat(actualPaymentProductOptional).isNotPresent();
}
@Test
void retrievePaymentId_success_existsInLink() {
String link = String.format(
"https://example.com/v1/%s/%s/%s",
PAYMENT_SERVICE, PAYMENT_PRODUCT, PAYMENT_ID
);
Optional<String> actualPaymentIdOptional = berlinGroupLinksRewriter.retrievePaymentId(link);
assertThat(actualPaymentIdOptional).contains(PAYMENT_ID);
}
@Test
void retrievePaymentId_failure_notExistsInLink() {
String link = "https://example.com/v1/";
Optional<String> actualPaymentIdOptional = berlinGroupLinksRewriter.retrievePaymentId(link);
assertThat(actualPaymentIdOptional).isNotPresent();
}
}
| 14,418 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
BaseOauth2ApiTest.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/test/java/de/adorsys/xs2a/adapter/impl/oauth2/api/BaseOauth2ApiTest.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl.oauth2.api;
import de.adorsys.xs2a.adapter.api.Response;
import de.adorsys.xs2a.adapter.api.http.HttpClient;
import de.adorsys.xs2a.adapter.api.http.Request;
import de.adorsys.xs2a.adapter.impl.http.RequestBuilderImpl;
import de.adorsys.xs2a.adapter.impl.oauth2.api.model.AuthorisationServerMetaData;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.*;
class BaseOauth2ApiTest<T extends AuthorisationServerMetaData> {
public static final String SCA_OAUTH_URL = "https://sca.oauth.url";
public static final String AUTHORISATION_ENDPOINT = "https://authorisation.endpoint";
public static final String TOKEN_ENDPOINT = "https://token.endpoint";
private HttpClient httpClient = mock(HttpClient.class);
private Request.Builder requestBuilder = spy(new RequestBuilderImpl(httpClient, "GET", null));
private ArgumentCaptor<String> urlCaptor = ArgumentCaptor.forClass(String.class);
private BaseOauth2Api<AuthorisationServerMetaData> api = new BaseOauth2Api<>(httpClient, AuthorisationServerMetaData.class);
@Test
void getAuthorisationUri() {
when(httpClient.get(any())).thenReturn(requestBuilder);
doReturn(dummyResponse()).when(requestBuilder).send(any());
String actual = api.getAuthorisationUri(SCA_OAUTH_URL);
verify(httpClient, times(1)).get(urlCaptor.capture());
verify(requestBuilder, times(1)).send(any());
assertThat(actual).isEqualTo(AUTHORISATION_ENDPOINT);
assertThat(urlCaptor.getValue()).isEqualTo(SCA_OAUTH_URL);
}
@Test
void getTokenUri() {
when(httpClient.get(any())).thenReturn(requestBuilder);
doReturn(dummyResponse()).when(requestBuilder).send(any());
String actual = api.getTokenUri(SCA_OAUTH_URL);
verify(httpClient, times(1)).get(urlCaptor.capture());
verify(requestBuilder, times(1)).send(any());
assertThat(actual).isEqualTo(TOKEN_ENDPOINT);
assertThat(urlCaptor.getValue()).isEqualTo(SCA_OAUTH_URL);
}
private Response<AuthorisationServerMetaData> dummyResponse() {
AuthorisationServerMetaData metaData = new AuthorisationServerMetaData();
metaData.setAuthorisationEndpoint(AUTHORISATION_ENDPOINT);
metaData.setTokenEndpoint(TOKEN_ENDPOINT);
return new Response<>(200, metaData, null);
}
}
| 3,310 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
BasePaymentInitiationService.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/main/java/de/adorsys/xs2a/adapter/impl/BasePaymentInitiationService.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl;
import de.adorsys.xs2a.adapter.api.PaymentInitiationService;
import de.adorsys.xs2a.adapter.api.RequestHeaders;
import de.adorsys.xs2a.adapter.api.RequestParams;
import de.adorsys.xs2a.adapter.api.Response;
import de.adorsys.xs2a.adapter.api.http.HttpClient;
import de.adorsys.xs2a.adapter.api.http.HttpLogSanitizer;
import de.adorsys.xs2a.adapter.api.http.Interceptor;
import de.adorsys.xs2a.adapter.api.http.Request;
import de.adorsys.xs2a.adapter.api.link.LinksRewriter;
import de.adorsys.xs2a.adapter.api.model.*;
import de.adorsys.xs2a.adapter.impl.http.ResponseHandlers;
import de.adorsys.xs2a.adapter.impl.http.StringUri;
import de.adorsys.xs2a.adapter.impl.link.identity.IdentityLinksRewriter;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
import static de.adorsys.xs2a.adapter.api.validation.Validation.requireValid;
import static java.util.function.Function.identity;
public class BasePaymentInitiationService extends AbstractService implements PaymentInitiationService {
private static final LinksRewriter DEFAULT_LINKS_REWRITER = new IdentityLinksRewriter();
protected static final String V1 = "v1";
protected final Aspsp aspsp;
private final List<Interceptor> interceptors;
private final LinksRewriter linksRewriter;
private final ResponseHandlers responseHandlers;
public BasePaymentInitiationService(Aspsp aspsp,
HttpClient httpClient,
List<Interceptor> interceptors) {
this(aspsp, httpClient, interceptors, DEFAULT_LINKS_REWRITER, null);
}
public BasePaymentInitiationService(Aspsp aspsp,
HttpClient httpClient,
LinksRewriter linksRewriter) {
this(aspsp, httpClient, Collections.emptyList(), linksRewriter, null);
}
public BasePaymentInitiationService(Aspsp aspsp,
HttpClient httpClient,
LinksRewriter linksRewriter,
HttpLogSanitizer logSanitizer) {
this(aspsp, httpClient, Collections.emptyList(), linksRewriter, logSanitizer);
}
public BasePaymentInitiationService(Aspsp aspsp,
HttpClient httpClient,
List<Interceptor> interceptors,
LinksRewriter linksRewriter) {
this(aspsp, httpClient, interceptors, linksRewriter, null);
}
public BasePaymentInitiationService(Aspsp aspsp,
HttpClient httpClient,
List<Interceptor> interceptors,
LinksRewriter linksRewriter,
HttpLogSanitizer logSanitizer) {
super(httpClient);
this.aspsp = aspsp;
this.interceptors = Optional.ofNullable(interceptors).orElseGet(Collections::emptyList);
this.linksRewriter = linksRewriter;
this.responseHandlers = new ResponseHandlers(logSanitizer);
}
@Override
public Response<PaymentInitationRequestResponse201> initiatePayment(PaymentService paymentService,
PaymentProduct paymentProduct,
RequestHeaders requestHeaders,
RequestParams requestParams,
Object body) {
return initiatePayment(
paymentService,
paymentProduct,
requestHeaders,
requestParams,
body,
PaymentInitationRequestResponse201.class,
identity());
}
protected <T> Response<PaymentInitationRequestResponse201> initiatePayment(PaymentService paymentService,
PaymentProduct paymentProduct,
RequestHeaders requestHeaders,
RequestParams requestParams,
Object body,
Class<T> klass,
Function<T, PaymentInitationRequestResponse201> mapper) {
return initiatePayment(paymentService, paymentProduct, body, requestHeaders, requestParams, mapper, responseHandlers.jsonResponseHandler(klass));
}
protected <T> Response<PaymentInitationRequestResponse201> initiatePayment(PaymentService paymentService,
PaymentProduct paymentProduct,
Object body,
RequestHeaders requestHeaders,
RequestParams requestParams,
Function<T, PaymentInitationRequestResponse201> mapper,
HttpClient.ResponseHandler<T> responseHandler) {
requireValid(validateInitiatePayment(paymentService, paymentProduct, requestHeaders, requestParams, body));
String uri = StringUri.fromElements(getPaymentBaseUri(), paymentService, paymentProduct);
uri = buildUri(uri, requestParams);
Map<String, String> headersMap = populatePostHeaders(requestHeaders.toMap());
headersMap = addPsuIdTypeHeader(headersMap);
Request.Builder requestBuilder = httpClient.post(uri)
.headers(headersMap);
if (body instanceof PeriodicPaymentInitiationMultipartBody) {
PeriodicPaymentInitiationMultipartBody multipartBody = (PeriodicPaymentInitiationMultipartBody) body;
requestBuilder.addXmlPart("xml_sct", (String) multipartBody.getXml_sct());
requestBuilder.addJsonPart("json_standingorderType",
jsonMapper.writeValueAsString(multipartBody.getJson_standingorderType()));
} else if (isXml(paymentProduct)) {
requestBuilder.xmlBody((String) body);
} else {
requestBuilder.jsonBody(jsonMapper.writeValueAsString(
jsonMapper.convertValue(body, getPaymentInitiationBodyClass(paymentService))));
}
Response<T> response = requestBuilder.send(responseHandler, interceptors);
PaymentInitationRequestResponse201 paymentInitiationRequestResponse = mapper.apply(response.getBody());
paymentInitiationRequestResponse.setLinks(linksRewriter.rewrite(paymentInitiationRequestResponse.getLinks()));
return new Response<>(response.getStatusCode(), paymentInitiationRequestResponse, response.getHeaders());
}
protected boolean isXml(PaymentProduct paymentProduct) {
return paymentProduct.toString().startsWith("pain.001");
}
@Override
public Response<PaymentInitiationWithStatusResponse> getSinglePaymentInformation(PaymentProduct paymentProduct,
String paymentId,
RequestHeaders requestHeaders,
RequestParams requestParams) {
requireValid(validateGetSinglePaymentInformation(paymentProduct, paymentId, requestHeaders, requestParams));
return getPaymentInformation(PaymentService.PAYMENTS,
paymentProduct,
paymentId,
requestHeaders,
requestParams,
responseHandlers.jsonResponseHandler(PaymentInitiationWithStatusResponse.class));
}
protected <T> Response<T> getPaymentInformation(PaymentService paymentService,
PaymentProduct paymentProduct,
String paymentId,
RequestHeaders requestHeaders,
RequestParams requestParams,
HttpClient.ResponseHandler<T> responseHandler) {
String uri = StringUri.fromElements(getPaymentBaseUri(), paymentService, paymentProduct, paymentId);
uri = buildUri(uri, requestParams);
Map<String, String> headersMap = populateGetHeaders(requestHeaders.toMap());
return httpClient.get(uri)
.headers(headersMap)
.send(responseHandler, interceptors);
}
@Override
public Response<PeriodicPaymentInitiationWithStatusResponse> getPeriodicPaymentInformation(PaymentProduct paymentProduct,
String paymentId,
RequestHeaders requestHeaders,
RequestParams requestParams) {
return getPeriodicPaymentInformation(paymentProduct,
paymentId,
requestHeaders,
requestParams,
PeriodicPaymentInitiationWithStatusResponse.class,
identity());
}
protected <T> Response<PeriodicPaymentInitiationWithStatusResponse> getPeriodicPaymentInformation(
PaymentProduct paymentProduct,
String paymentId,
RequestHeaders requestHeaders,
RequestParams requestParams,
Class<T> klass,
Function<T, PeriodicPaymentInitiationWithStatusResponse> mapper
) {
requireValid(validateGetPeriodicPaymentInformation(paymentProduct, paymentId, requestHeaders, requestParams));
return getPaymentInformation(PaymentService.PERIODIC_PAYMENTS,
paymentProduct,
paymentId,
requestHeaders,
requestParams,
responseHandlers.jsonResponseHandler(klass))
.map(mapper);
}
@Override
public Response<PeriodicPaymentInitiationMultipartBody> getPeriodicPain001PaymentInformation(PaymentProduct paymentProduct,
String paymentId,
RequestHeaders requestHeaders,
RequestParams requestParams) {
return getPeriodicPain001PaymentInformation(paymentProduct,
paymentId,
requestHeaders,
requestParams,
PeriodicPaymentInitiationMultipartBody.class,
identity());
}
protected <T> Response<PeriodicPaymentInitiationMultipartBody> getPeriodicPain001PaymentInformation(
PaymentProduct paymentProduct,
String paymentId,
RequestHeaders requestHeaders,
RequestParams requestParams,
Class<T> klass,
Function<T, PeriodicPaymentInitiationMultipartBody> mapper
) {
requireValid(validateGetPeriodicPain001PaymentInformation(paymentProduct, paymentId, requestHeaders, requestParams));
return getPaymentInformation(PaymentService.PERIODIC_PAYMENTS,
paymentProduct,
paymentId,
requestHeaders,
requestParams,
responseHandlers.multipartFormDataResponseHandler(klass))
.map(mapper);
}
@Override
public Response<String> getPaymentInformationAsString(PaymentService paymentService,
PaymentProduct paymentProduct,
String paymentId,
RequestHeaders requestHeaders,
RequestParams requestParams) {
return getPaymentInformation(paymentService,
paymentProduct,
paymentId,
requestHeaders,
requestParams,
responseHandlers.stringResponseHandler());
}
@Override
public Response<ScaStatusResponse> getPaymentInitiationScaStatus(PaymentService paymentService,
PaymentProduct paymentProduct,
String paymentId,
String authorisationId,
RequestHeaders requestHeaders,
RequestParams requestParams) {
return getPaymentInitiationScaStatus(paymentService,
paymentProduct,
paymentId,
authorisationId,
requestHeaders,
requestParams,
ScaStatusResponse.class,
identity());
}
protected <T> Response<ScaStatusResponse> getPaymentInitiationScaStatus(PaymentService paymentService,
PaymentProduct paymentProduct,
String paymentId,
String authorisationId,
RequestHeaders requestHeaders,
RequestParams requestParams,
Class<T> klass,
Function<T, ScaStatusResponse> mapper) {
requireValid(validateGetPaymentInitiationScaStatus(paymentService,
paymentProduct,
paymentId,
authorisationId,
requestHeaders,
requestParams));
String uri = StringUri.fromElements(getPaymentBaseUri(),
paymentService,
paymentProduct,
paymentId,
AUTHORISATIONS,
authorisationId);
uri = buildUri(uri, requestParams);
Map<String, String> headersMap = populateGetHeaders(requestHeaders.toMap());
return httpClient.get(uri)
.headers(headersMap)
.send(responseHandlers.jsonResponseHandler(klass), interceptors)
.map(mapper);
}
@Override
public Response<PaymentInitiationStatusResponse200Json> getPaymentInitiationStatus(PaymentService paymentService,
PaymentProduct paymentProduct,
String paymentId,
RequestHeaders requestHeaders,
RequestParams requestParams) {
requireValid(validateGetPaymentInitiationStatus(paymentService, paymentProduct, paymentId, requestHeaders,
requestParams));
String uri = getPaymentInitiationStatusUri(paymentService, paymentProduct, paymentId);
uri = buildUri(uri, requestParams);
Map<String, String> headersMap = populateGetHeaders(requestHeaders.toMap());
return httpClient.get(uri)
.headers(headersMap)
.send(responseHandlers.jsonResponseHandler(PaymentInitiationStatusResponse200Json.class), interceptors);
}
@Override
public Response<String> getPaymentInitiationStatusAsString(PaymentService paymentService,
PaymentProduct paymentProduct,
String paymentId,
RequestHeaders requestHeaders,
RequestParams requestParams) {
requireValid(validateGetPaymentInitiationStatusAsString(paymentService, paymentProduct, paymentId, requestHeaders, requestParams));
String uri = getPaymentInitiationStatusUri(paymentService, paymentProduct, paymentId);
uri = buildUri(uri, requestParams);
Map<String, String> headersMap = populateGetHeaders(requestHeaders.toMap());
return httpClient.get(uri)
.headers(headersMap)
.send(responseHandlers.stringResponseHandler(), interceptors);
}
private String getPaymentInitiationStatusUri(PaymentService paymentService,
PaymentProduct paymentProduct,
String paymentId) {
return StringUri.fromElements(getPaymentBaseUri(), paymentService, paymentProduct, paymentId, STATUS);
}
@Override
public Response<Authorisations> getPaymentInitiationAuthorisation(PaymentService paymentService,
PaymentProduct paymentProduct,
String paymentId,
RequestHeaders requestHeaders,
RequestParams requestParams) {
return getPaymentInitiationAuthorisation(paymentService,
paymentProduct,
paymentId,
requestHeaders,
requestParams,
Authorisations.class,
identity());
}
protected <T> Response<Authorisations> getPaymentInitiationAuthorisation(PaymentService paymentService,
PaymentProduct paymentProduct,
String paymentId,
RequestHeaders requestHeaders,
RequestParams requestParams,
Class<T> klass,
Function<T, Authorisations> mapper) {
requireValid(validateGetPaymentInitiationAuthorisation(paymentService,
paymentProduct,
paymentId,
requestHeaders,
requestParams));
String uri = StringUri.fromElements(getPaymentBaseUri(),
paymentService,
paymentProduct,
paymentId,
AUTHORISATIONS);
uri = buildUri(uri, requestParams);
Map<String, String> headersMap = populateGetHeaders(requestHeaders.toMap());
return httpClient.get(uri)
.headers(headersMap)
.send(responseHandlers.jsonResponseHandler(klass), interceptors)
.map(mapper);
}
@Override
public Response<StartScaprocessResponse> startPaymentAuthorisation(PaymentService paymentService,
PaymentProduct paymentProduct,
String paymentId,
RequestHeaders requestHeaders,
RequestParams requestParams) {
return startPaymentAuthorisation(paymentService,
paymentProduct,
paymentId,
requestHeaders,
requestParams,
StartScaprocessResponse.class,
identity());
}
protected <T> Response<StartScaprocessResponse> startPaymentAuthorisation(PaymentService paymentService,
PaymentProduct paymentProduct,
String paymentId,
RequestHeaders requestHeaders,
RequestParams requestParams,
Class<T> klass,
Function<T, StartScaprocessResponse> mapper) {
requireValid(validateStartPaymentAuthorisation(paymentService, paymentProduct, paymentId, requestHeaders, requestParams));
String uri = StringUri.fromElements(getPaymentBaseUri(), paymentService, paymentProduct, paymentId, AUTHORISATIONS);
uri = buildUri(uri, requestParams);
Map<String, String> headersMap = populatePostHeaders(requestHeaders.toMap());
Response<StartScaprocessResponse> response = httpClient.post(uri)
.headers(headersMap)
.emptyBody(true)
.send(responseHandlers.jsonResponseHandler(klass), interceptors)
.map(mapper);
Optional.ofNullable(response.getBody())
.ifPresent(body -> body.setLinks(linksRewriter.rewrite(body.getLinks())));
return response;
}
@Override
public Response<StartScaprocessResponse> startPaymentAuthorisation(PaymentService paymentService,
PaymentProduct paymentProduct,
String paymentId,
RequestHeaders requestHeaders,
RequestParams requestParams,
UpdatePsuAuthentication updatePsuAuthentication) {
return startPaymentAuthorisation(paymentService,
paymentProduct,
paymentId,
requestHeaders,
requestParams,
updatePsuAuthentication,
StartScaprocessResponse.class,
identity());
}
protected <T> Response<StartScaprocessResponse> startPaymentAuthorisation(PaymentService paymentService,
PaymentProduct paymentProduct,
String paymentId,
RequestHeaders requestHeaders,
RequestParams requestParams,
UpdatePsuAuthentication updatePsuAuthentication,
Class<T> klass,
Function<T, StartScaprocessResponse> mapper) {
requireValid(validateStartPaymentAuthorisation(paymentService, paymentProduct, paymentId, requestHeaders,
requestParams, updatePsuAuthentication));
String uri = StringUri.fromElements(getPaymentBaseUri(), paymentService, paymentProduct, paymentId,
AUTHORISATIONS);
uri = buildUri(uri, requestParams);
Map<String, String> headersMap = populatePostHeaders(requestHeaders.toMap());
String body = jsonMapper.writeValueAsString(updatePsuAuthentication);
Response<T> response = httpClient.post(uri)
.jsonBody(body)
.headers(headersMap)
.send(responseHandlers.jsonResponseHandler(klass), interceptors);
StartScaprocessResponse startScaProcessResponse = mapper.apply(response.getBody());
startScaProcessResponse.setLinks(linksRewriter.rewrite(startScaProcessResponse.getLinks()));
return new Response<>(response.getStatusCode(), startScaProcessResponse, response.getHeaders());
}
@Override
public Response<UpdatePsuAuthenticationResponse> updatePaymentPsuData(PaymentService paymentService,
PaymentProduct paymentProduct,
String paymentId,
String authorisationId,
RequestHeaders requestHeaders,
RequestParams requestParams,
UpdatePsuAuthentication updatePsuAuthentication) {
return updatePaymentPsuData(paymentService,
paymentProduct,
paymentId,
authorisationId,
requestHeaders,
requestParams,
updatePsuAuthentication,
UpdatePsuAuthenticationResponse.class,
identity());
}
protected <T> Response<UpdatePsuAuthenticationResponse> updatePaymentPsuData(PaymentService paymentService,
PaymentProduct paymentProduct,
String paymentId,
String authorisationId,
RequestHeaders requestHeaders,
RequestParams requestParams,
UpdatePsuAuthentication updatePsuAuthentication,
Class<T> klass,
Function<T, UpdatePsuAuthenticationResponse> mapper) {
requireValid(validateUpdatePaymentPsuData(paymentService,
paymentProduct,
paymentId,
authorisationId,
requestHeaders,
requestParams,
updatePsuAuthentication));
String uri = StringUri.fromElements(getPaymentBaseUri(), paymentService, paymentProduct, paymentId, AUTHORISATIONS, authorisationId);
uri = buildUri(uri, requestParams);
Map<String, String> headersMap = populatePutHeaders(requestHeaders.toMap());
headersMap = addPsuIdTypeHeader(headersMap);
String body = jsonMapper.writeValueAsString(updatePsuAuthentication);
Response<T> response = httpClient.put(uri)
.jsonBody(body)
.headers(headersMap)
.send(responseHandlers.jsonResponseHandler(klass), interceptors);
UpdatePsuAuthenticationResponse updatePsuAuthenticationResponse = mapper.apply(response.getBody());
updatePsuAuthenticationResponse.setLinks(linksRewriter.rewrite(updatePsuAuthenticationResponse.getLinks()));
return new Response<>(response.getStatusCode(), updatePsuAuthenticationResponse, response.getHeaders());
}
@Override
public Response<SelectPsuAuthenticationMethodResponse> updatePaymentPsuData(PaymentService paymentService,
PaymentProduct paymentProduct,
String paymentId,
String authorisationId,
RequestHeaders requestHeaders,
RequestParams requestParams,
SelectPsuAuthenticationMethod selectPsuAuthenticationMethod) {
return updatePaymentPsuData(paymentService,
paymentProduct,
paymentId,
authorisationId,
requestHeaders,
requestParams,
selectPsuAuthenticationMethod,
SelectPsuAuthenticationMethodResponse.class,
identity());
}
protected <T> Response<SelectPsuAuthenticationMethodResponse> updatePaymentPsuData(PaymentService paymentService,
PaymentProduct paymentProduct,
String paymentId,
String authorisationId,
RequestHeaders requestHeaders,
RequestParams requestParams,
SelectPsuAuthenticationMethod selectPsuAuthenticationMethod,
Class<T> klass,
Function<T, SelectPsuAuthenticationMethodResponse> mapper) {
requireValid(validateUpdatePaymentPsuData(paymentService,
paymentProduct,
paymentId,
authorisationId,
requestHeaders,
requestParams,
selectPsuAuthenticationMethod));
String uri = StringUri.fromElements(getPaymentBaseUri(), paymentService, paymentProduct, paymentId, AUTHORISATIONS, authorisationId);
uri = buildUri(uri, requestParams);
Map<String, String> headersMap = populatePutHeaders(requestHeaders.toMap());
headersMap = addPsuIdTypeHeader(headersMap);
String body = jsonMapper.writeValueAsString(selectPsuAuthenticationMethod);
Response<T> response = httpClient.put(uri)
.jsonBody(body)
.headers(headersMap)
.send(responseHandlers.jsonResponseHandler(klass), interceptors);
SelectPsuAuthenticationMethodResponse selectPsuAuthenticationMethodResponse = mapper.apply(response.getBody());
selectPsuAuthenticationMethodResponse.setLinks(linksRewriter.rewrite(selectPsuAuthenticationMethodResponse.getLinks()));
return new Response<>(response.getStatusCode(), selectPsuAuthenticationMethodResponse, response.getHeaders());
}
@Override
public Response<ScaStatusResponse> updatePaymentPsuData(PaymentService paymentService,
PaymentProduct paymentProduct,
String paymentId,
String authorisationId,
RequestHeaders requestHeaders,
RequestParams requestParams,
TransactionAuthorisation transactionAuthorisation) {
return updatePaymentPsuData(paymentService,
paymentProduct,
paymentId,
authorisationId,
requestHeaders,
requestParams,
transactionAuthorisation,
ScaStatusResponse.class,
identity());
}
protected <T> Response<ScaStatusResponse> updatePaymentPsuData(PaymentService paymentService,
PaymentProduct paymentProduct,
String paymentId,
String authorisationId,
RequestHeaders requestHeaders,
RequestParams requestParams,
TransactionAuthorisation transactionAuthorisation,
Class<T> klass,
Function<T, ScaStatusResponse> mapper) {
requireValid(validateUpdatePaymentPsuData(paymentService,
paymentProduct,
paymentId,
authorisationId,
requestHeaders,
requestParams,
transactionAuthorisation));
String uri = getUpdatePaymentPsuDataUri(paymentService, paymentProduct, paymentId, authorisationId);
uri = buildUri(uri, requestParams);
Map<String, String> headersMap = populatePutHeaders(requestHeaders.toMap());
headersMap = addPsuIdTypeHeader(headersMap);
String body = jsonMapper.writeValueAsString(transactionAuthorisation);
Response<T> response = httpClient.put(uri)
.jsonBody(body)
.headers(headersMap)
.send(responseHandlers.jsonResponseHandler(klass), interceptors);
ScaStatusResponse scaStatusResponse = mapper.apply(response.getBody());
return new Response<>(response.getStatusCode(), scaStatusResponse, response.getHeaders());
}
protected String getUpdatePaymentPsuDataUri(PaymentService paymentService,
PaymentProduct paymentProduct,
String paymentId,
String authorisationId) {
return StringUri.fromElements(getPaymentBaseUri(),
paymentService,
paymentProduct,
paymentId,
AUTHORISATIONS,
authorisationId);
}
protected String getIdpUri() {
return aspsp.getIdpUrl();
}
protected String getPaymentBaseUri() {
return StringUri.fromElements(aspsp.getUrl(), V1);
}
}
| 36,027 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
Oauth2ServiceDecorator.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/main/java/de/adorsys/xs2a/adapter/impl/Oauth2ServiceDecorator.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl;
import de.adorsys.xs2a.adapter.api.Oauth2Service;
import de.adorsys.xs2a.adapter.api.model.TokenResponse;
import de.adorsys.xs2a.adapter.api.validation.ValidationError;
import java.io.IOException;
import java.net.URI;
import java.util.List;
import java.util.Map;
public abstract class Oauth2ServiceDecorator implements Oauth2Service {
protected final Oauth2Service oauth2Service;
public Oauth2ServiceDecorator(Oauth2Service oauth2Service) {
this.oauth2Service = oauth2Service;
}
@Override
public URI getAuthorizationRequestUri(Map<String, String> headers, Parameters parameters) throws IOException {
return oauth2Service.getAuthorizationRequestUri(headers, parameters);
}
@Override
public TokenResponse getToken(Map<String, String> headers, Parameters parameters) throws IOException {
return oauth2Service.getToken(headers, parameters);
}
@Override
public List<ValidationError> validateGetAuthorizationRequestUri(Map<String, String> headers, Parameters parameters) {
return oauth2Service.validateGetAuthorizationRequestUri(headers, parameters);
}
@Override
public List<ValidationError> validateGetToken(Map<String, String> headers, Parameters parameters) {
return oauth2Service.validateGetToken(headers, parameters);
}
}
| 2,197 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
CertificateSubjectClientIdOauth2Service.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/main/java/de/adorsys/xs2a/adapter/impl/CertificateSubjectClientIdOauth2Service.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl;
import de.adorsys.xs2a.adapter.api.Oauth2Service;
import de.adorsys.xs2a.adapter.api.Pkcs12KeyStore;
import de.adorsys.xs2a.adapter.api.exception.Xs2aAdapterException;
import de.adorsys.xs2a.adapter.api.model.TokenResponse;
import de.adorsys.xs2a.adapter.impl.http.UriBuilder;
import java.io.IOException;
import java.net.URI;
import java.security.KeyStoreException;
import java.util.Map;
/**
* Sets client_id parameter to organization identifier from eIDAS certificate.
*/
public class CertificateSubjectClientIdOauth2Service implements Oauth2Service {
private final Oauth2Service oauth2Service;
private final Pkcs12KeyStore keyStore;
public CertificateSubjectClientIdOauth2Service(Oauth2Service oauth2Service, Pkcs12KeyStore keyStore) {
this.oauth2Service = oauth2Service;
this.keyStore = keyStore;
}
@Override
public URI getAuthorizationRequestUri(Map<String, String> headers, Parameters parameters) throws IOException {
return UriBuilder.fromUri(oauth2Service.getAuthorizationRequestUri(headers, parameters))
.queryParam(Parameters.CLIENT_ID, clientId(parameters))
.build();
}
private String clientId(Parameters parameters) {
String clientId = parameters.getClientId();
if (clientId != null) {
return clientId;
}
try {
return keyStore.getOrganizationIdentifier();
} catch (KeyStoreException e) {
throw new Xs2aAdapterException(e);
}
}
@Override
public TokenResponse getToken(Map<String, String> headers, Parameters parameters) throws IOException {
parameters.setClientId(clientId(parameters));
return oauth2Service.getToken(headers, parameters);
}
}
| 2,626 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
PkceOauth2Service.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/main/java/de/adorsys/xs2a/adapter/impl/PkceOauth2Service.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl;
import de.adorsys.xs2a.adapter.api.Oauth2Service;
import de.adorsys.xs2a.adapter.api.PkceOauth2Extension;
import de.adorsys.xs2a.adapter.api.model.TokenResponse;
import de.adorsys.xs2a.adapter.impl.http.UriBuilder;
import java.io.IOException;
import java.net.URI;
import java.util.Map;
/**
* @see <a href="https://tools.ietf.org/html/rfc7636">Proof Key for Code Exchange</a>
*/
public class PkceOauth2Service implements Oauth2Service, PkceOauth2Extension {
private final Oauth2Service oauth2Service;
public PkceOauth2Service(Oauth2Service oauth2Service) {
this.oauth2Service = oauth2Service;
}
@Override
public URI getAuthorizationRequestUri(Map<String, String> headers, Parameters parameters) throws IOException {
return UriBuilder.fromUri(oauth2Service.getAuthorizationRequestUri(headers, parameters))
.queryParam(Parameters.CODE_CHALLENGE_METHOD, orElse(parameters.getCodeChallengeMethod(), "S256"))
.queryParam(Parameters.CODE_CHALLENGE, orElse(parameters.getCodeChallenge(), this.codeChallenge()))
.build();
}
@Override
public TokenResponse getToken(Map<String, String> headers, Parameters parameters) throws IOException {
if (GrantType.AUTHORIZATION_CODE.toString().equals(parameters.getGrantType())) {
parameters.setCodeVerifier(orElse(parameters.getCodeVerifier(), this.codeVerifier()));
}
return oauth2Service.getToken(headers, parameters);
}
private String orElse(String optionalValue, String defaultValue) {
if (optionalValue != null) {
return optionalValue;
}
return defaultValue;
}
}
| 2,543 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |
AbstractService.java | /FileExtraction/Java_unseen/adorsys_xs2a-adapter/xs2a-adapter-service-impl/src/main/java/de/adorsys/xs2a/adapter/impl/AbstractService.java | /*
* Copyright 2018-2022 adorsys GmbH & Co KG
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version. This program is distributed in the hope that
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*
* This project is also available under a separate commercial license. You can
* contact us at [email protected].
*/
package de.adorsys.xs2a.adapter.impl;
import de.adorsys.xs2a.adapter.api.RequestHeaders;
import de.adorsys.xs2a.adapter.api.RequestParams;
import de.adorsys.xs2a.adapter.api.http.HttpClient;
import de.adorsys.xs2a.adapter.api.model.PaymentInitiationJson;
import de.adorsys.xs2a.adapter.api.model.PaymentService;
import de.adorsys.xs2a.adapter.api.model.PeriodicPaymentInitiationJson;
import de.adorsys.xs2a.adapter.impl.http.JacksonObjectMapper;
import de.adorsys.xs2a.adapter.impl.http.JsonMapper;
import de.adorsys.xs2a.adapter.impl.http.StringUri;
import java.util.EnumMap;
import java.util.Map;
public abstract class AbstractService {
private static final EnumMap<PaymentService, Class<?>> PAYMENT_INITIATION_BODY_CLASSES =
new EnumMap<>(PaymentService.class);
protected static final String AUTHORISATIONS = "authorisations";
protected static final String STATUS = "status";
protected static final String ACCEPT_HEADER = "Accept";
protected final JsonMapper jsonMapper = new JacksonObjectMapper();
protected final HttpClient httpClient;
static {
PAYMENT_INITIATION_BODY_CLASSES.put(PaymentService.PAYMENTS, PaymentInitiationJson.class);
PAYMENT_INITIATION_BODY_CLASSES.put(PaymentService.PERIODIC_PAYMENTS, PeriodicPaymentInitiationJson.class);
}
protected AbstractService(HttpClient httpClient) {
this.httpClient = httpClient;
}
/**
* In default implementation, adds a PSU-ID header.
*
* @param headers request headers
* @return list of headers with added an empty PSU-ID header
*/
protected Map<String, String> resolvePsuIdHeader(Map<String, String> headers) {
if (!headers.containsKey(RequestHeaders.PSU_ID)) {
headers.put(RequestHeaders.PSU_ID, "");
}
return headers;
}
protected Map<String, String> addPsuIdTypeHeader(Map<String, String> headers) {
return headers;
}
protected Map<String, String> addConsentIdHeader(Map<String, String> headers) {
return headers;
}
protected Map<String, String> populatePostHeaders(Map<String, String> headers) {
return headers;
}
protected Map<String, String> populatePutHeaders(Map<String, String> headers) {
return headers;
}
protected Map<String, String> populateGetHeaders(Map<String, String> headers) {
return headers;
}
protected Map<String, String> populateDeleteHeaders(Map<String, String> headers) {
return headers;
}
protected static String buildUri(String uri, RequestParams requestParams) {
if (requestParams == null) {
return uri;
}
Map<String, String> requestParamsMap = requestParams.toMap();
return StringUri.withQuery(uri, requestParamsMap);
}
protected Class<?> getPaymentInitiationBodyClass(PaymentService paymentService) {
Class<?> paymentInitiationBodyClass = PAYMENT_INITIATION_BODY_CLASSES.get(paymentService);
if (paymentInitiationBodyClass == null) {
throw new IllegalArgumentException("Unsupported payment service: " + paymentService);
}
return paymentInitiationBodyClass;
}
}
| 4,039 | Java | .java | adorsys/xs2a-adapter | 37 | 25 | 5 | 2019-04-01T09:31:44Z | 2024-03-09T08:27:14Z |