Skip to content

Commit 964b06a

Browse files
Merge pull request #1057 from Adyen/automation/release
Release v20.1.1
2 parents 5f6f38b + 0da7b28 commit 964b06a

File tree

114 files changed

+1705
-1395
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+1705
-1395
lines changed

Diff for: .github/scripts/helper.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
exports.pomJavaVersion = () => {
2+
const fs = require('fs');
3+
const re = /<version>(\d{1,2}.\d.\d)<\/version>\n.*<name>Adyen Java API Library<\/name>/;
4+
data = fs.readFileSync("pom.xml", 'utf-8');
5+
version = data.match(re)[1];
6+
return version;
7+
}
8+
9+
// Update version in pom.xml and settings
10+
exports.updateJavaVersion = async (version) => {
11+
const fs = require('fs');
12+
data = fs.readFileSync('src/main/java/com/adyen/Client.java', 'utf-8');
13+
newVersion = data.replace(/(LIB_VERSION = )"(\d{1,2}\.\d\.\d)"/, "$1" + '"' + version +'"');
14+
fs.writeFileSync('src/main/java/com/adyen/Client.java', newVersion, 'utf-8');
15+
16+
data = fs.readFileSync('pom.xml', 'utf-8');
17+
newVersion = data.replace(/(<version>)(\d{1,2}.\d.\d)(<\/version>\n.*<name>Adyen Java API Library<\/name>)/, "$1" + version + "$3");
18+
fs.writeFileSync('pom.xml', newVersion, 'utf-8');
19+
}

Diff for: .github/workflows/gh-release.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Github Release
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
gh_release:
11+
permissions:
12+
contents: write
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
token: ${{ secrets.ADYEN_AUTOMATION_BOT_ACCESS_TOKEN }}
19+
- name: Grab version
20+
uses: actions/github-script@v6
21+
id: release
22+
with:
23+
script: |
24+
const helper = require('./.github/scripts/helper.js')
25+
core.setOutput('version', helper.pomJavaVersion())
26+
- name: Create new release
27+
env:
28+
GH_TOKEN: ${{ secrets.ADYEN_AUTOMATION_BOT_ACCESS_TOKEN }}
29+
run: |
30+
gh release create v${{steps.release.outputs.version}} \
31+
--title 'Adyen Java API Library v${{steps.release.outputs.version}}' \
32+
--generate-notes --target main
33+
- name: Update develop branch
34+
run: |
35+
git checkout develop
36+
git merge main
37+
git push origin develop

Diff for: .github/workflows/release.yml

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Release request
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- develop
8+
9+
jobs:
10+
release:
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
with:
18+
ref: main
19+
- name: Reset promotion branch
20+
run: |
21+
git fetch origin develop:develop
22+
git reset --hard develop
23+
- name: Get the release script
24+
run: |
25+
wget https://raw.githubusercontent.com/Adyen/adyen-node-api-library/develop/.github/scripts/release.js -P ./.github/scripts
26+
- name: Prepare release request
27+
uses: actions/github-script@v6
28+
id: release
29+
with:
30+
script: |
31+
const helper = require('./.github/scripts/helper.js')
32+
const release = require('./.github/scripts/release.js')
33+
const options = { github, context, core, getCurrentVersion: helper.pomJavaVersion };
34+
await release.bump(options);
35+
- name: Bump version
36+
uses: actions/github-script@v6
37+
with:
38+
script: |
39+
const helper = require('./.github/scripts/helper.js')
40+
await helper.updateJavaVersion("${{steps.release.outputs.nextVersion}}");
41+
- name: Delete the release script
42+
run: |
43+
rm -f ./.github/scripts/release.js
44+
- name: Create Pull Request
45+
id: cpr
46+
uses: peter-evans/create-pull-request@284f54f989303d2699d373481a0cfa13ad5a6666 # v5.0.1
47+
with:
48+
token: ${{ secrets.ADYEN_AUTOMATION_BOT_ACCESS_TOKEN }}
49+
committer: ${{ secrets.ADYEN_AUTOMATION_BOT_EMAIL }}
50+
author: ${{ secrets.ADYEN_AUTOMATION_BOT_EMAIL }}
51+
branch: automation/release
52+
title: Release v${{steps.release.outputs.nextVersion}}
53+
body: |
54+
Merged pull requests to be released:
55+
${{steps.release.outputs.changelog}}
56+
commit-message: "chore(release): bump to ${{steps.release.outputs.nextVersion}}"
57+
delete-branch: true
58+
- name: Enable Pull Request Automerge
59+
if: steps.cpr.outputs.pull-request-operation == 'created'
60+
uses: peter-evans/enable-pull-request-automerge@a660677d5469627102a1c1e11409dd063606628d # v3.0.0
61+
with:
62+
token: ${{ secrets.ADYEN_AUTOMATION_BOT_ACCESS_TOKEN }}
63+
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
64+
merge-method: merge

Diff for: pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<groupId>com.adyen</groupId>
55
<artifactId>adyen-java-api-library</artifactId>
66
<packaging>jar</packaging>
7-
<version>20.1.0</version>
7+
<version>20.1.1</version>
88
<name>Adyen Java API Library</name>
99
<description>Adyen API Client Library for Java</description>
1010
<url>https://github.com/adyen/adyen-java-api-library</url>

Diff for: src/main/java/com/adyen/Client.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public class Client {
4444
public static final String MARKETPAY_NOTIFICATION_API_VERSION = "v6";
4545
public static final String MARKETPAY_HOP_API_VERSION = "v6";
4646
public static final String LIB_NAME = "adyen-java-api-library";
47-
public static final String LIB_VERSION = "20.1.0";
47+
public static final String LIB_VERSION = "20.1.1";
4848
public static final String CHECKOUT_ENDPOINT_TEST = "https://checkout-test.adyen.com/checkout";
4949
public static final String CHECKOUT_ENDPOINT_LIVE_SUFFIX = "-checkout-live.adyenpayments.com/checkout";
5050
public static final String CHECKOUT_ENDPOINT_CERT_LIVE = "https://checkoutcert-live-%s.adyen.com/checkout";

Diff for: src/main/java/com/adyen/model/balanceplatform/AULocalAccountIdentification.java

+15-14
Original file line numberDiff line numberDiff line change
@@ -235,32 +235,33 @@ private String toIndentedString(Object o) {
235235
openapiRequiredFields.add("bsbCode");
236236
openapiRequiredFields.add("type");
237237
}
238-
/**
239-
* logger for Deserialization Errors
240-
*/
241-
private static final Logger log = Logger.getLogger(AULocalAccountIdentification.class.getName());
242238

239+
public static void validateJsonObject(JsonObject jsonObj) throws IOException {
240+
validateJsonObject(jsonObj, false);
241+
}
243242
/**
244243
* Validates the JSON Object and throws an exception if issues found
245244
*
246245
* @param jsonObj JSON Object
246+
* @param strictValidation reject (new) fields missing from the specifications
247247
* @throws IOException if the JSON Object is invalid with respect to AULocalAccountIdentification
248248
*/
249-
public static void validateJsonObject(JsonObject jsonObj) throws IOException {
249+
public static void validateJsonObject(JsonObject jsonObj, boolean strictValidation) throws IOException {
250250
if (jsonObj == null) {
251251
if (AULocalAccountIdentification.openapiRequiredFields.isEmpty()) {
252252
return;
253253
} else { // has required fields
254254
throw new IllegalArgumentException(String.format("The required field(s) %s in AULocalAccountIdentification is not found in the empty JSON string", AULocalAccountIdentification.openapiRequiredFields.toString()));
255255
}
256256
}
257-
258-
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
259-
// check to see if the JSON string contains additional fields
260-
for (Entry<String, JsonElement> entry : entries) {
261-
if (!AULocalAccountIdentification.openapiFields.contains(entry.getKey())) {
262-
log.log(Level.WARNING, String.format("The field `%s` in the JSON string is not defined in the `AULocalAccountIdentification` properties.", entry.getKey()));
263-
}
257+
if (strictValidation) {
258+
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
259+
// check to see if the JSON string contains additional fields
260+
for (Entry<String, JsonElement> entry : entries) {
261+
if (!AULocalAccountIdentification.openapiFields.contains(entry.getKey())) {
262+
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AULocalAccountIdentification` properties.", entry.getKey()));
263+
}
264+
}
264265
}
265266

266267
// check to make sure all required properties/fields are present in the JSON string
@@ -271,11 +272,11 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException {
271272
}
272273
// validate the optional field accountNumber
273274
if (jsonObj.get("accountNumber") != null && !jsonObj.get("accountNumber").isJsonPrimitive()) {
274-
log.log(Level.WARNING, String.format("Expected the field `accountNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountNumber").toString()));
275+
throw new IllegalArgumentException(String.format("Expected the field `accountNumber` to be a primitive type in the JSON string but got `%s`", jsonObj.get("accountNumber").toString()));
275276
}
276277
// validate the optional field bsbCode
277278
if (jsonObj.get("bsbCode") != null && !jsonObj.get("bsbCode").isJsonPrimitive()) {
278-
log.log(Level.WARNING, String.format("Expected the field `bsbCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("bsbCode").toString()));
279+
throw new IllegalArgumentException(String.format("Expected the field `bsbCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("bsbCode").toString()));
279280
}
280281
// ensure the field type can be parsed to an enum value
281282
if (jsonObj.get("type") != null) {

Diff for: src/main/java/com/adyen/model/balanceplatform/AccountHolder.java

+20-19
Original file line numberDiff line numberDiff line change
@@ -516,32 +516,33 @@ private String toIndentedString(Object o) {
516516
openapiRequiredFields.add("id");
517517
openapiRequiredFields.add("legalEntityId");
518518
}
519-
/**
520-
* logger for Deserialization Errors
521-
*/
522-
private static final Logger log = Logger.getLogger(AccountHolder.class.getName());
523519

520+
public static void validateJsonObject(JsonObject jsonObj) throws IOException {
521+
validateJsonObject(jsonObj, false);
522+
}
524523
/**
525524
* Validates the JSON Object and throws an exception if issues found
526525
*
527526
* @param jsonObj JSON Object
527+
* @param strictValidation reject (new) fields missing from the specifications
528528
* @throws IOException if the JSON Object is invalid with respect to AccountHolder
529529
*/
530-
public static void validateJsonObject(JsonObject jsonObj) throws IOException {
530+
public static void validateJsonObject(JsonObject jsonObj, boolean strictValidation) throws IOException {
531531
if (jsonObj == null) {
532532
if (AccountHolder.openapiRequiredFields.isEmpty()) {
533533
return;
534534
} else { // has required fields
535535
throw new IllegalArgumentException(String.format("The required field(s) %s in AccountHolder is not found in the empty JSON string", AccountHolder.openapiRequiredFields.toString()));
536536
}
537537
}
538-
539-
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
540-
// check to see if the JSON string contains additional fields
541-
for (Entry<String, JsonElement> entry : entries) {
542-
if (!AccountHolder.openapiFields.contains(entry.getKey())) {
543-
log.log(Level.WARNING, String.format("The field `%s` in the JSON string is not defined in the `AccountHolder` properties.", entry.getKey()));
544-
}
538+
if (strictValidation) {
539+
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
540+
// check to see if the JSON string contains additional fields
541+
for (Entry<String, JsonElement> entry : entries) {
542+
if (!AccountHolder.openapiFields.contains(entry.getKey())) {
543+
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AccountHolder` properties.", entry.getKey()));
544+
}
545+
}
545546
}
546547

547548
// check to make sure all required properties/fields are present in the JSON string
@@ -552,31 +553,31 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException {
552553
}
553554
// validate the optional field balancePlatform
554555
if (jsonObj.get("balancePlatform") != null && !jsonObj.get("balancePlatform").isJsonPrimitive()) {
555-
log.log(Level.WARNING, String.format("Expected the field `balancePlatform` to be a primitive type in the JSON string but got `%s`", jsonObj.get("balancePlatform").toString()));
556+
throw new IllegalArgumentException(String.format("Expected the field `balancePlatform` to be a primitive type in the JSON string but got `%s`", jsonObj.get("balancePlatform").toString()));
556557
}
557558
// validate the optional field `contactDetails`
558559
if (jsonObj.getAsJsonObject("contactDetails") != null) {
559560
ContactDetails.validateJsonObject(jsonObj.getAsJsonObject("contactDetails"));
560561
}
561562
// validate the optional field description
562563
if (jsonObj.get("description") != null && !jsonObj.get("description").isJsonPrimitive()) {
563-
log.log(Level.WARNING, String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString()));
564+
throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString()));
564565
}
565566
// validate the optional field id
566567
if (jsonObj.get("id") != null && !jsonObj.get("id").isJsonPrimitive()) {
567-
log.log(Level.WARNING, String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString()));
568+
throw new IllegalArgumentException(String.format("Expected the field `id` to be a primitive type in the JSON string but got `%s`", jsonObj.get("id").toString()));
568569
}
569570
// validate the optional field legalEntityId
570571
if (jsonObj.get("legalEntityId") != null && !jsonObj.get("legalEntityId").isJsonPrimitive()) {
571-
log.log(Level.WARNING, String.format("Expected the field `legalEntityId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("legalEntityId").toString()));
572+
throw new IllegalArgumentException(String.format("Expected the field `legalEntityId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("legalEntityId").toString()));
572573
}
573574
// validate the optional field primaryBalanceAccount
574575
if (jsonObj.get("primaryBalanceAccount") != null && !jsonObj.get("primaryBalanceAccount").isJsonPrimitive()) {
575-
log.log(Level.WARNING, String.format("Expected the field `primaryBalanceAccount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("primaryBalanceAccount").toString()));
576+
throw new IllegalArgumentException(String.format("Expected the field `primaryBalanceAccount` to be a primitive type in the JSON string but got `%s`", jsonObj.get("primaryBalanceAccount").toString()));
576577
}
577578
// validate the optional field reference
578579
if (jsonObj.get("reference") != null && !jsonObj.get("reference").isJsonPrimitive()) {
579-
log.log(Level.WARNING, String.format("Expected the field `reference` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reference").toString()));
580+
throw new IllegalArgumentException(String.format("Expected the field `reference` to be a primitive type in the JSON string but got `%s`", jsonObj.get("reference").toString()));
580581
}
581582
// ensure the field status can be parsed to an enum value
582583
if (jsonObj.get("status") != null) {
@@ -587,7 +588,7 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException {
587588
}
588589
// validate the optional field timeZone
589590
if (jsonObj.get("timeZone") != null && !jsonObj.get("timeZone").isJsonPrimitive()) {
590-
log.log(Level.WARNING, String.format("Expected the field `timeZone` to be a primitive type in the JSON string but got `%s`", jsonObj.get("timeZone").toString()));
591+
throw new IllegalArgumentException(String.format("Expected the field `timeZone` to be a primitive type in the JSON string but got `%s`", jsonObj.get("timeZone").toString()));
591592
}
592593
JsonArray jsonArrayverificationDeadlines = jsonObj.getAsJsonArray("verificationDeadlines");
593594
if (jsonArrayverificationDeadlines != null) {

Diff for: src/main/java/com/adyen/model/balanceplatform/AccountHolderCapability.java

+14-13
Original file line numberDiff line numberDiff line change
@@ -533,32 +533,33 @@ private String toIndentedString(Object o) {
533533
// a set of required properties/fields (JSON key names)
534534
openapiRequiredFields = new HashSet<String>();
535535
}
536-
/**
537-
* logger for Deserialization Errors
538-
*/
539-
private static final Logger log = Logger.getLogger(AccountHolderCapability.class.getName());
540536

537+
public static void validateJsonObject(JsonObject jsonObj) throws IOException {
538+
validateJsonObject(jsonObj, false);
539+
}
541540
/**
542541
* Validates the JSON Object and throws an exception if issues found
543542
*
544543
* @param jsonObj JSON Object
544+
* @param strictValidation reject (new) fields missing from the specifications
545545
* @throws IOException if the JSON Object is invalid with respect to AccountHolderCapability
546546
*/
547-
public static void validateJsonObject(JsonObject jsonObj) throws IOException {
547+
public static void validateJsonObject(JsonObject jsonObj, boolean strictValidation) throws IOException {
548548
if (jsonObj == null) {
549549
if (AccountHolderCapability.openapiRequiredFields.isEmpty()) {
550550
return;
551551
} else { // has required fields
552552
throw new IllegalArgumentException(String.format("The required field(s) %s in AccountHolderCapability is not found in the empty JSON string", AccountHolderCapability.openapiRequiredFields.toString()));
553553
}
554554
}
555-
556-
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
557-
// check to see if the JSON string contains additional fields
558-
for (Entry<String, JsonElement> entry : entries) {
559-
if (!AccountHolderCapability.openapiFields.contains(entry.getKey())) {
560-
log.log(Level.WARNING, String.format("The field `%s` in the JSON string is not defined in the `AccountHolderCapability` properties.", entry.getKey()));
561-
}
555+
if (strictValidation) {
556+
Set<Entry<String, JsonElement>> entries = jsonObj.entrySet();
557+
// check to see if the JSON string contains additional fields
558+
for (Entry<String, JsonElement> entry : entries) {
559+
if (!AccountHolderCapability.openapiFields.contains(entry.getKey())) {
560+
throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AccountHolderCapability` properties.", entry.getKey()));
561+
}
562+
}
562563
}
563564
// ensure the field allowedLevel can be parsed to an enum value
564565
if (jsonObj.get("allowedLevel") != null) {
@@ -573,7 +574,7 @@ public static void validateJsonObject(JsonObject jsonObj) throws IOException {
573574
}
574575
// ensure the json data is an array
575576
if (jsonObj.get("problems") != null && !jsonObj.get("problems").isJsonArray()) {
576-
log.log(Level.WARNING, String.format("Expected the field `problems` to be an array in the JSON string but got `%s`", jsonObj.get("problems").toString()));
577+
throw new IllegalArgumentException(String.format("Expected the field `problems` to be an array in the JSON string but got `%s`", jsonObj.get("problems").toString()));
577578
}
578579
// ensure the field requestedLevel can be parsed to an enum value
579580
if (jsonObj.get("requestedLevel") != null) {

0 commit comments

Comments
 (0)