From 9fa67e7b0f218284b159145d343632f12d633ab4 Mon Sep 17 00:00:00 2001 From: Michael Paul Date: Thu, 20 Jul 2023 17:55:44 +0200 Subject: [PATCH 1/2] Remove deprecated challengeIndicator field (#1089) From ThreeDS2Result. --- .../adyen/model/checkout/ThreeDS2Result.java | 215 +++++++++--------- src/test/java/com/adyen/CheckoutTest.java | 13 ++ ...sResponseThreeDSRequestorChallengeInd.json | 48 ++++ 3 files changed, 171 insertions(+), 105 deletions(-) create mode 100644 src/test/resources/mocks/checkout/paymentDetailsResponseThreeDSRequestorChallengeInd.json diff --git a/src/main/java/com/adyen/model/checkout/ThreeDS2Result.java b/src/main/java/com/adyen/model/checkout/ThreeDS2Result.java index 891fbc488..507585099 100644 --- a/src/main/java/com/adyen/model/checkout/ThreeDS2Result.java +++ b/src/main/java/com/adyen/model/checkout/ThreeDS2Result.java @@ -2,7 +2,7 @@ * Adyen Checkout API * * The version of the OpenAPI document: 70 - * Contact: developer-experience@adyen.com + * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech @@ -119,22 +119,30 @@ public ChallengeCancelEnum read(final JsonReader jsonReader) throws IOException @SerializedName(SERIALIZED_NAME_CHALLENGE_CANCEL) private ChallengeCancelEnum challengeCancel; + public static final String SERIALIZED_NAME_DS_TRANS_I_D = "dsTransID"; + @SerializedName(SERIALIZED_NAME_DS_TRANS_I_D) + private String dsTransID; + + public static final String SERIALIZED_NAME_ECI = "eci"; + @SerializedName(SERIALIZED_NAME_ECI) + private String eci; + /** - * Specifies a preference for receiving a challenge from the issuer. Allowed values: * `noPreference` * `requestNoChallenge` * `requestChallenge` * `requestChallengeAsMandate` + * Indicates the exemption type that was applied by the issuer to the authentication, if exemption applied. Allowed values: * `lowValue` * `secureCorporate` * `trustedBeneficiary` * `transactionRiskAnalysis` */ - @JsonAdapter(ChallengeIndicatorEnum.Adapter.class) - public enum ChallengeIndicatorEnum { - NOPREFERENCE("noPreference"), + @JsonAdapter(ExemptionIndicatorEnum.Adapter.class) + public enum ExemptionIndicatorEnum { + LOWVALUE("lowValue"), - REQUESTNOCHALLENGE("requestNoChallenge"), + SECURECORPORATE("secureCorporate"), - REQUESTCHALLENGE("requestChallenge"), + TRUSTEDBENEFICIARY("trustedBeneficiary"), - REQUESTCHALLENGEASMANDATE("requestChallengeAsMandate"); + TRANSACTIONRISKANALYSIS("transactionRiskAnalysis"); private String value; - ChallengeIndicatorEnum(String value) { + ExemptionIndicatorEnum(String value) { this.value = value; } @@ -147,8 +155,8 @@ public String toString() { return String.valueOf(value); } - public static ChallengeIndicatorEnum fromValue(String value) { - for (ChallengeIndicatorEnum b : ChallengeIndicatorEnum.values()) { + public static ExemptionIndicatorEnum fromValue(String value) { + for (ExemptionIndicatorEnum b : ExemptionIndicatorEnum.values()) { if (b.value.equals(value)) { return b; } @@ -156,48 +164,52 @@ public static ChallengeIndicatorEnum fromValue(String value) { throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - public static class Adapter extends TypeAdapter { + public static class Adapter extends TypeAdapter { @Override - public void write(final JsonWriter jsonWriter, final ChallengeIndicatorEnum enumeration) throws IOException { + public void write(final JsonWriter jsonWriter, final ExemptionIndicatorEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override - public ChallengeIndicatorEnum read(final JsonReader jsonReader) throws IOException { + public ExemptionIndicatorEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); - return ChallengeIndicatorEnum.fromValue(value); + return ExemptionIndicatorEnum.fromValue(value); } } } - public static final String SERIALIZED_NAME_CHALLENGE_INDICATOR = "challengeIndicator"; - @SerializedName(SERIALIZED_NAME_CHALLENGE_INDICATOR) - private ChallengeIndicatorEnum challengeIndicator; + public static final String SERIALIZED_NAME_EXEMPTION_INDICATOR = "exemptionIndicator"; + @SerializedName(SERIALIZED_NAME_EXEMPTION_INDICATOR) + private ExemptionIndicatorEnum exemptionIndicator; - public static final String SERIALIZED_NAME_DS_TRANS_I_D = "dsTransID"; - @SerializedName(SERIALIZED_NAME_DS_TRANS_I_D) - private String dsTransID; + public static final String SERIALIZED_NAME_MESSAGE_VERSION = "messageVersion"; + @SerializedName(SERIALIZED_NAME_MESSAGE_VERSION) + private String messageVersion; - public static final String SERIALIZED_NAME_ECI = "eci"; - @SerializedName(SERIALIZED_NAME_ECI) - private String eci; + public static final String SERIALIZED_NAME_RISK_SCORE = "riskScore"; + @SerializedName(SERIALIZED_NAME_RISK_SCORE) + private String riskScore; /** - * Indicates the exemption type that was applied by the issuer to the authentication, if exemption applied. Allowed values: * `lowValue` * `secureCorporate` * `trustedBeneficiary` * `transactionRiskAnalysis` + * Indicates whether a challenge is requested for this transaction. Possible values: * **01** — No preference * **02** — No challenge requested * **03** — Challenge requested (3DS Requestor preference) * **04** — Challenge requested (Mandate) * **05** — No challenge (transactional risk analysis is already performed) * **06** — Data Only */ - @JsonAdapter(ExemptionIndicatorEnum.Adapter.class) - public enum ExemptionIndicatorEnum { - LOWVALUE("lowValue"), + @JsonAdapter(ThreeDSRequestorChallengeIndEnum.Adapter.class) + public enum ThreeDSRequestorChallengeIndEnum { + _01("01"), - SECURECORPORATE("secureCorporate"), + _02("02"), - TRUSTEDBENEFICIARY("trustedBeneficiary"), + _03("03"), - TRANSACTIONRISKANALYSIS("transactionRiskAnalysis"); + _04("04"), + + _05("05"), + + _06("06"); private String value; - ExemptionIndicatorEnum(String value) { + ThreeDSRequestorChallengeIndEnum(String value) { this.value = value; } @@ -210,8 +222,8 @@ public String toString() { return String.valueOf(value); } - public static ExemptionIndicatorEnum fromValue(String value) { - for (ExemptionIndicatorEnum b : ExemptionIndicatorEnum.values()) { + public static ThreeDSRequestorChallengeIndEnum fromValue(String value) { + for (ThreeDSRequestorChallengeIndEnum b : ThreeDSRequestorChallengeIndEnum.values()) { if (b.value.equals(value)) { return b; } @@ -219,31 +231,23 @@ public static ExemptionIndicatorEnum fromValue(String value) { throw new IllegalArgumentException("Unexpected value '" + value + "'"); } - public static class Adapter extends TypeAdapter { + public static class Adapter extends TypeAdapter { @Override - public void write(final JsonWriter jsonWriter, final ExemptionIndicatorEnum enumeration) throws IOException { + public void write(final JsonWriter jsonWriter, final ThreeDSRequestorChallengeIndEnum enumeration) throws IOException { jsonWriter.value(enumeration.getValue()); } @Override - public ExemptionIndicatorEnum read(final JsonReader jsonReader) throws IOException { + public ThreeDSRequestorChallengeIndEnum read(final JsonReader jsonReader) throws IOException { String value = jsonReader.nextString(); - return ExemptionIndicatorEnum.fromValue(value); + return ThreeDSRequestorChallengeIndEnum.fromValue(value); } } } - public static final String SERIALIZED_NAME_EXEMPTION_INDICATOR = "exemptionIndicator"; - @SerializedName(SERIALIZED_NAME_EXEMPTION_INDICATOR) - private ExemptionIndicatorEnum exemptionIndicator; - - public static final String SERIALIZED_NAME_MESSAGE_VERSION = "messageVersion"; - @SerializedName(SERIALIZED_NAME_MESSAGE_VERSION) - private String messageVersion; - - public static final String SERIALIZED_NAME_RISK_SCORE = "riskScore"; - @SerializedName(SERIALIZED_NAME_RISK_SCORE) - private String riskScore; + public static final String SERIALIZED_NAME_THREE_D_S_REQUESTOR_CHALLENGE_IND = "threeDSRequestorChallengeInd"; + @SerializedName(SERIALIZED_NAME_THREE_D_S_REQUESTOR_CHALLENGE_IND) + private ThreeDSRequestorChallengeIndEnum threeDSRequestorChallengeInd; public static final String SERIALIZED_NAME_THREE_D_S_SERVER_TRANS_I_D = "threeDSServerTransID"; @SerializedName(SERIALIZED_NAME_THREE_D_S_SERVER_TRANS_I_D) @@ -334,28 +338,6 @@ public void setChallengeCancel(ChallengeCancelEnum challengeCancel) { } - public ThreeDS2Result challengeIndicator(ChallengeIndicatorEnum challengeIndicator) { - - this.challengeIndicator = challengeIndicator; - return this; - } - - /** - * Specifies a preference for receiving a challenge from the issuer. Allowed values: * `noPreference` * `requestNoChallenge` * `requestChallenge` * `requestChallengeAsMandate` - * @return challengeIndicator - **/ - @ApiModelProperty(value = "Specifies a preference for receiving a challenge from the issuer. Allowed values: * `noPreference` * `requestNoChallenge` * `requestChallenge` * `requestChallengeAsMandate` ") - - public ChallengeIndicatorEnum getChallengeIndicator() { - return challengeIndicator; - } - - - public void setChallengeIndicator(ChallengeIndicatorEnum challengeIndicator) { - this.challengeIndicator = challengeIndicator; - } - - public ThreeDS2Result dsTransID(String dsTransID) { this.dsTransID = dsTransID; @@ -466,6 +448,28 @@ public void setRiskScore(String riskScore) { } + public ThreeDS2Result threeDSRequestorChallengeInd(ThreeDSRequestorChallengeIndEnum threeDSRequestorChallengeInd) { + + this.threeDSRequestorChallengeInd = threeDSRequestorChallengeInd; + return this; + } + + /** + * Indicates whether a challenge is requested for this transaction. Possible values: * **01** — No preference * **02** — No challenge requested * **03** — Challenge requested (3DS Requestor preference) * **04** — Challenge requested (Mandate) * **05** — No challenge (transactional risk analysis is already performed) * **06** — Data Only + * @return threeDSRequestorChallengeInd + **/ + @ApiModelProperty(value = "Indicates whether a challenge is requested for this transaction. Possible values: * **01** — No preference * **02** — No challenge requested * **03** — Challenge requested (3DS Requestor preference) * **04** — Challenge requested (Mandate) * **05** — No challenge (transactional risk analysis is already performed) * **06** — Data Only") + + public ThreeDSRequestorChallengeIndEnum getThreeDSRequestorChallengeInd() { + return threeDSRequestorChallengeInd; + } + + + public void setThreeDSRequestorChallengeInd(ThreeDSRequestorChallengeIndEnum threeDSRequestorChallengeInd) { + this.threeDSRequestorChallengeInd = threeDSRequestorChallengeInd; + } + + public ThreeDS2Result threeDSServerTransID(String threeDSServerTransID) { this.threeDSServerTransID = threeDSServerTransID; @@ -589,12 +593,12 @@ public boolean equals(Object o) { return Objects.equals(this.authenticationValue, threeDS2Result.authenticationValue) && Objects.equals(this.cavvAlgorithm, threeDS2Result.cavvAlgorithm) && Objects.equals(this.challengeCancel, threeDS2Result.challengeCancel) && - Objects.equals(this.challengeIndicator, threeDS2Result.challengeIndicator) && Objects.equals(this.dsTransID, threeDS2Result.dsTransID) && Objects.equals(this.eci, threeDS2Result.eci) && Objects.equals(this.exemptionIndicator, threeDS2Result.exemptionIndicator) && Objects.equals(this.messageVersion, threeDS2Result.messageVersion) && Objects.equals(this.riskScore, threeDS2Result.riskScore) && + Objects.equals(this.threeDSRequestorChallengeInd, threeDS2Result.threeDSRequestorChallengeInd) && Objects.equals(this.threeDSServerTransID, threeDS2Result.threeDSServerTransID) && Objects.equals(this.timestamp, threeDS2Result.timestamp) && Objects.equals(this.transStatus, threeDS2Result.transStatus) && @@ -604,7 +608,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(authenticationValue, cavvAlgorithm, challengeCancel, challengeIndicator, dsTransID, eci, exemptionIndicator, messageVersion, riskScore, threeDSServerTransID, timestamp, transStatus, transStatusReason, whiteListStatus); + return Objects.hash(authenticationValue, cavvAlgorithm, challengeCancel, dsTransID, eci, exemptionIndicator, messageVersion, riskScore, threeDSRequestorChallengeInd, threeDSServerTransID, timestamp, transStatus, transStatusReason, whiteListStatus); } @Override @@ -614,12 +618,12 @@ public String toString() { sb.append(" authenticationValue: ").append(toIndentedString(authenticationValue)).append("\n"); sb.append(" cavvAlgorithm: ").append(toIndentedString(cavvAlgorithm)).append("\n"); sb.append(" challengeCancel: ").append(toIndentedString(challengeCancel)).append("\n"); - sb.append(" challengeIndicator: ").append(toIndentedString(challengeIndicator)).append("\n"); sb.append(" dsTransID: ").append(toIndentedString(dsTransID)).append("\n"); sb.append(" eci: ").append(toIndentedString(eci)).append("\n"); sb.append(" exemptionIndicator: ").append(toIndentedString(exemptionIndicator)).append("\n"); sb.append(" messageVersion: ").append(toIndentedString(messageVersion)).append("\n"); sb.append(" riskScore: ").append(toIndentedString(riskScore)).append("\n"); + sb.append(" threeDSRequestorChallengeInd: ").append(toIndentedString(threeDSRequestorChallengeInd)).append("\n"); sb.append(" threeDSServerTransID: ").append(toIndentedString(threeDSServerTransID)).append("\n"); sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); sb.append(" transStatus: ").append(toIndentedString(transStatus)).append("\n"); @@ -650,12 +654,12 @@ private String toIndentedString(Object o) { openapiFields.add("authenticationValue"); openapiFields.add("cavvAlgorithm"); openapiFields.add("challengeCancel"); - openapiFields.add("challengeIndicator"); openapiFields.add("dsTransID"); openapiFields.add("eci"); openapiFields.add("exemptionIndicator"); openapiFields.add("messageVersion"); openapiFields.add("riskScore"); + openapiFields.add("threeDSRequestorChallengeInd"); openapiFields.add("threeDSServerTransID"); openapiFields.add("timestamp"); openapiFields.add("transStatus"); @@ -665,18 +669,18 @@ private String toIndentedString(Object o) { // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(); } - /** - * logger for Deserialization Errors - */ - private static final Logger log = Logger.getLogger(ThreeDS2Result.class.getName()); + public static void validateJsonObject(JsonObject jsonObj) throws IOException { + validateJsonObject(jsonObj, false); + } /** * Validates the JSON Object and throws an exception if issues found * * @param jsonObj JSON Object + * @param strictValidation reject (new) fields missing from the specifications * @throws IOException if the JSON Object is invalid with respect to ThreeDS2Result */ - public static void validateJsonObject(JsonObject jsonObj) throws IOException { + public static void validateJsonObject(JsonObject jsonObj, boolean strictValidation) throws IOException { if (jsonObj == null) { if (ThreeDS2Result.openapiRequiredFields.isEmpty()) { return; @@ -684,21 +688,22 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { throw new IllegalArgumentException(String.format("The required field(s) %s in ThreeDS2Result is not found in the empty JSON string", ThreeDS2Result.openapiRequiredFields.toString())); } } - - Set> entries = jsonObj.entrySet(); - // check to see if the JSON string contains additional fields - for (Entry entry : entries) { - if (!ThreeDS2Result.openapiFields.contains(entry.getKey())) { - log.log(Level.WARNING, String.format("The field `%s` in the JSON string is not defined in the `ThreeDS2Result` properties.", entry.getKey())); - } + if (strictValidation) { + Set> entries = jsonObj.entrySet(); + // check to see if the JSON string contains additional fields + for (Entry entry : entries) { + if (!ThreeDS2Result.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ThreeDS2Result` properties.", entry.getKey())); + } + } } // validate the optional field authenticationValue if (jsonObj.get("authenticationValue") != null && !jsonObj.get("authenticationValue").isJsonPrimitive()) { - log.log(Level.WARNING, String.format("Expected the field `authenticationValue` to be a primitive type in the JSON string but got `%s`", jsonObj.get("authenticationValue").toString())); + throw new IllegalArgumentException(String.format("Expected the field `authenticationValue` to be a primitive type in the JSON string but got `%s`", jsonObj.get("authenticationValue").toString())); } // validate the optional field cavvAlgorithm if (jsonObj.get("cavvAlgorithm") != null && !jsonObj.get("cavvAlgorithm").isJsonPrimitive()) { - log.log(Level.WARNING, String.format("Expected the field `cavvAlgorithm` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cavvAlgorithm").toString())); + throw new IllegalArgumentException(String.format("Expected the field `cavvAlgorithm` to be a primitive type in the JSON string but got `%s`", jsonObj.get("cavvAlgorithm").toString())); } // ensure the field challengeCancel can be parsed to an enum value if (jsonObj.get("challengeCancel") != null) { @@ -707,20 +712,13 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { } ChallengeCancelEnum.fromValue(jsonObj.get("challengeCancel").getAsString()); } - // ensure the field challengeIndicator can be parsed to an enum value - if (jsonObj.get("challengeIndicator") != null) { - if(!jsonObj.get("challengeIndicator").isJsonPrimitive()) { - throw new IllegalArgumentException(String.format("Expected the field `challengeIndicator` to be a primitive type in the JSON string but got `%s`", jsonObj.get("challengeIndicator").toString())); - } - ChallengeIndicatorEnum.fromValue(jsonObj.get("challengeIndicator").getAsString()); - } // validate the optional field dsTransID if (jsonObj.get("dsTransID") != null && !jsonObj.get("dsTransID").isJsonPrimitive()) { - log.log(Level.WARNING, String.format("Expected the field `dsTransID` to be a primitive type in the JSON string but got `%s`", jsonObj.get("dsTransID").toString())); + throw new IllegalArgumentException(String.format("Expected the field `dsTransID` to be a primitive type in the JSON string but got `%s`", jsonObj.get("dsTransID").toString())); } // validate the optional field eci if (jsonObj.get("eci") != null && !jsonObj.get("eci").isJsonPrimitive()) { - log.log(Level.WARNING, String.format("Expected the field `eci` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eci").toString())); + throw new IllegalArgumentException(String.format("Expected the field `eci` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eci").toString())); } // ensure the field exemptionIndicator can be parsed to an enum value if (jsonObj.get("exemptionIndicator") != null) { @@ -731,31 +729,38 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException { } // validate the optional field messageVersion if (jsonObj.get("messageVersion") != null && !jsonObj.get("messageVersion").isJsonPrimitive()) { - log.log(Level.WARNING, String.format("Expected the field `messageVersion` to be a primitive type in the JSON string but got `%s`", jsonObj.get("messageVersion").toString())); + throw new IllegalArgumentException(String.format("Expected the field `messageVersion` to be a primitive type in the JSON string but got `%s`", jsonObj.get("messageVersion").toString())); } // validate the optional field riskScore if (jsonObj.get("riskScore") != null && !jsonObj.get("riskScore").isJsonPrimitive()) { - log.log(Level.WARNING, String.format("Expected the field `riskScore` to be a primitive type in the JSON string but got `%s`", jsonObj.get("riskScore").toString())); + throw new IllegalArgumentException(String.format("Expected the field `riskScore` to be a primitive type in the JSON string but got `%s`", jsonObj.get("riskScore").toString())); + } + // ensure the field threeDSRequestorChallengeInd can be parsed to an enum value + if (jsonObj.get("threeDSRequestorChallengeInd") != null) { + if(!jsonObj.get("threeDSRequestorChallengeInd").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `threeDSRequestorChallengeInd` to be a primitive type in the JSON string but got `%s`", jsonObj.get("threeDSRequestorChallengeInd").toString())); + } + ThreeDSRequestorChallengeIndEnum.fromValue(jsonObj.get("threeDSRequestorChallengeInd").getAsString()); } // validate the optional field threeDSServerTransID if (jsonObj.get("threeDSServerTransID") != null && !jsonObj.get("threeDSServerTransID").isJsonPrimitive()) { - log.log(Level.WARNING, String.format("Expected the field `threeDSServerTransID` to be a primitive type in the JSON string but got `%s`", jsonObj.get("threeDSServerTransID").toString())); + throw new IllegalArgumentException(String.format("Expected the field `threeDSServerTransID` to be a primitive type in the JSON string but got `%s`", jsonObj.get("threeDSServerTransID").toString())); } // validate the optional field timestamp if (jsonObj.get("timestamp") != null && !jsonObj.get("timestamp").isJsonPrimitive()) { - log.log(Level.WARNING, String.format("Expected the field `timestamp` to be a primitive type in the JSON string but got `%s`", jsonObj.get("timestamp").toString())); + throw new IllegalArgumentException(String.format("Expected the field `timestamp` to be a primitive type in the JSON string but got `%s`", jsonObj.get("timestamp").toString())); } // validate the optional field transStatus if (jsonObj.get("transStatus") != null && !jsonObj.get("transStatus").isJsonPrimitive()) { - log.log(Level.WARNING, String.format("Expected the field `transStatus` to be a primitive type in the JSON string but got `%s`", jsonObj.get("transStatus").toString())); + throw new IllegalArgumentException(String.format("Expected the field `transStatus` to be a primitive type in the JSON string but got `%s`", jsonObj.get("transStatus").toString())); } // validate the optional field transStatusReason if (jsonObj.get("transStatusReason") != null && !jsonObj.get("transStatusReason").isJsonPrimitive()) { - log.log(Level.WARNING, String.format("Expected the field `transStatusReason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("transStatusReason").toString())); + throw new IllegalArgumentException(String.format("Expected the field `transStatusReason` to be a primitive type in the JSON string but got `%s`", jsonObj.get("transStatusReason").toString())); } // validate the optional field whiteListStatus if (jsonObj.get("whiteListStatus") != null && !jsonObj.get("whiteListStatus").isJsonPrimitive()) { - log.log(Level.WARNING, String.format("Expected the field `whiteListStatus` to be a primitive type in the JSON string but got `%s`", jsonObj.get("whiteListStatus").toString())); + throw new IllegalArgumentException(String.format("Expected the field `whiteListStatus` to be a primitive type in the JSON string but got `%s`", jsonObj.get("whiteListStatus").toString())); } } diff --git a/src/test/java/com/adyen/CheckoutTest.java b/src/test/java/com/adyen/CheckoutTest.java index 452492b85..8b46a8466 100644 --- a/src/test/java/com/adyen/CheckoutTest.java +++ b/src/test/java/com/adyen/CheckoutTest.java @@ -180,6 +180,19 @@ public void TestPaymentDetailsSuccess() throws Exception { assertEquals("V4HZ4RBFJGXXGN82", paymentDetailsResponse.getPspReference()); } + @Test + public void TestPaymentDetailsWithThreeDSRequestorChallengeInd() throws Exception { + Client client = createMockClientFromFile("mocks/checkout/paymentDetailsResponseThreeDSRequestorChallengeInd.json"); + DetailsRequest detailsRequest = new DetailsRequest(); + detailsRequest.setPaymentData("STATE_DATA"); + PaymentsApi checkout = new PaymentsApi(client); + + PaymentDetailsResponse paymentDetailsResponse = checkout.paymentsDetails(detailsRequest); + + assertEquals(PaymentDetailsResponse.ResultCodeEnum.REFUSED, paymentDetailsResponse.getResultCode()); + assertEquals(ThreeDS2Result.ThreeDSRequestorChallengeIndEnum._01, paymentDetailsResponse.getThreeDS2Result().getThreeDSRequestorChallengeInd()); + } + /** * Should make sessions call */ diff --git a/src/test/resources/mocks/checkout/paymentDetailsResponseThreeDSRequestorChallengeInd.json b/src/test/resources/mocks/checkout/paymentDetailsResponseThreeDSRequestorChallengeInd.json new file mode 100644 index 000000000..9cec68fde --- /dev/null +++ b/src/test/resources/mocks/checkout/paymentDetailsResponseThreeDSRequestorChallengeInd.json @@ -0,0 +1,48 @@ +{ + "additionalData": { + "threeDSVersion": "2.2.0", + "threeds2.threeDS2Result.transStatus": "U", + "threeds2.threeDS2Result.challengeIndicator": "01", + "paymentMethodVariant": "cartebancaire", + "threeds2.threeDS2Result.cavvAlgorithm": "2", + "threeds2.threeDS2Result.challengeCancel": "01", + "threeds2.threeDS2Result.threeDSRequestorChallengeInd": "01", + "threeDOffered": "true", + "threeds2.threeDS2Result.eci": "07", + "threeDOfferedResponse": "C", + "threeDAuthenticatedResponse": "U", + "threeds2.threeDS2Result.whiteListStatus": "Y", + "paymentMethod": "cartebancaire", + "threeds2.threeDS2Result.riskScore": "9", + "threeds2.threeDS2Result.transStatusReason": "01", + "threeds2.threeDS2Result.messageVersion": "2.2.0" + }, + "pspReference": "FooBar", + "refusalReason": "3D Not Authenticated", + "resultCode": "Refused", + "refusalReasonCode": "11", + "amount": { + "currency": "EUR", + "value": 1500 + }, + "merchantReference": "FooBar123", + "paymentMethod": { + "brand": "cartebancaire", + "type": "scheme" + }, + "threeDS2Result": { + "authenticationValue": "Rm9vQmFy", + "cavvAlgorithm": "2", + "challengeCancel": "01", + "challengeIndicator": "01", + "dsTransID": "abc-123", + "eci": "07", + "messageVersion": "2.2.0", + "riskScore": "9", + "threeDSRequestorChallengeInd": "01", + "threeDSServerTransID": "xyz-123", + "transStatus": "U", + "transStatusReason": "01", + "whiteListStatus": "Y" + } +} \ No newline at end of file From c1917edb7d04056bf7649c0bfb9ee7ed8fabe845 Mon Sep 17 00:00:00 2001 From: michaelpa Date: Thu, 20 Jul 2023 18:05:13 +0200 Subject: [PATCH 2/2] Version Bump 20.1.2 --- README.md | 2 +- pom.xml | 2 +- src/main/java/com/adyen/Client.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index dddd7ab8b..696bd13ad 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ You can use Maven and add this dependency to your project's POM: com.adyen adyen-java-api-library - 20.1.0 + 20.1.2 ``` diff --git a/pom.xml b/pom.xml index 0469d7a2d..dad5e6eac 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.adyen adyen-java-api-library jar - 20.1.1 + 20.1.2 Adyen Java API Library Adyen API Client Library for Java https://github.com/adyen/adyen-java-api-library diff --git a/src/main/java/com/adyen/Client.java b/src/main/java/com/adyen/Client.java index aab5d551b..bdcdc284e 100644 --- a/src/main/java/com/adyen/Client.java +++ b/src/main/java/com/adyen/Client.java @@ -44,7 +44,7 @@ public class Client { public static final String MARKETPAY_NOTIFICATION_API_VERSION = "v6"; public static final String MARKETPAY_HOP_API_VERSION = "v6"; public static final String LIB_NAME = "adyen-java-api-library"; - public static final String LIB_VERSION = "20.1.1"; + public static final String LIB_VERSION = "20.1.2"; public static final String CHECKOUT_ENDPOINT_TEST = "https://checkout-test.adyen.com/checkout"; public static final String CHECKOUT_ENDPOINT_LIVE_SUFFIX = "-checkout-live.adyenpayments.com/checkout"; public static final String CHECKOUT_ENDPOINT_CERT_LIVE = "https://checkoutcert-live-%s.adyen.com/checkout";