From 753468a9176c839f5adefc2923d9714855c202c7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 18 Jan 2024 00:44:44 +0000 Subject: [PATCH] chore: auto update client extensions samples --- .../Dockerfile | 5 ++ .../LCP.json | 31 +++++++++ .../assets/index.js | 23 +++++++ .../build.gradle | 40 ++++++++++++ .../client-extension.yaml | 23 +++++++ .../package.json | 13 ++++ .../liferay/sample/ActionRestController.java | 62 ++++++++++++++++++ .../liferay/sample/BaseRestController.java | 64 +++++++++++++++++++ .../liferay/sample/ReadyRestController.java | 26 ++++++++ .../sample/SampleSpringBootApplication.java | 27 ++++++++ .../resources/application-default.properties | 20 ++++++ .../src/main/resources/application.properties | 4 ++ .../sample/AuthorizeRestController.java | 15 +++-- .../liferay/sample/CancelRestController.java | 11 ++-- .../liferay/sample/CaptureRestController.java | 11 ++-- .../liferay/sample/RefundRestController.java | 11 ++-- .../sample/SetUpPaymentRestController.java | 11 ++-- 17 files changed, 372 insertions(+), 25 deletions(-) create mode 100644 lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/Dockerfile create mode 100644 lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/LCP.json create mode 100644 lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/assets/index.js create mode 100644 lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/build.gradle create mode 100644 lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/client-extension.yaml create mode 100644 lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/package.json create mode 100644 lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/src/main/java/com/liferay/sample/ActionRestController.java create mode 100644 lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/src/main/java/com/liferay/sample/BaseRestController.java create mode 100644 lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/src/main/java/com/liferay/sample/ReadyRestController.java create mode 100644 lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/src/main/java/com/liferay/sample/SampleSpringBootApplication.java create mode 100644 lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/src/main/resources/application-default.properties create mode 100644 lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/src/main/resources/application.properties diff --git a/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/Dockerfile b/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/Dockerfile new file mode 100644 index 0000000..c6c52b5 --- /dev/null +++ b/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/Dockerfile @@ -0,0 +1,5 @@ +FROM liferay/jar-runner:latest + +COPY *.jar /opt/liferay/jar-runner.jar + +#ENV LIFERAY_JAR_RUNNER_JAVA_OPTS="-Xmx512m" \ No newline at end of file diff --git a/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/LCP.json b/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/LCP.json new file mode 100644 index 0000000..51d9dd8 --- /dev/null +++ b/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/LCP.json @@ -0,0 +1,31 @@ +{ + "cpu": 1, + "env": { + "LIFERAY_ROUTES_CLIENT_EXTENSION": "/etc/liferay/lxc/ext-init-metadata", + "LIFERAY_ROUTES_DXP": "/etc/liferay/lxc/dxp-metadata" + }, + "environments": { + "infra": { + "deploy": false + } + }, + "id": "__PROJECT_ID__", + "kind": "Deployment", + "livenessProbe": { + "httpGet": { + "path": "/ready", + "port": 58081 + } + }, + "loadBalancer": { + "targetPort": 58081 + }, + "memory": 512, + "readinessProbe": { + "httpGet": { + "path": "/ready", + "port": 58081 + } + }, + "scale": 1 +} \ No newline at end of file diff --git a/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/assets/index.js b/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/assets/index.js new file mode 100644 index 0000000..437d520 --- /dev/null +++ b/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/assets/index.js @@ -0,0 +1,23 @@ +/** + * SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com + * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06 + */ + +export default function CommerceCheckoutStep() { + const commerceCheckoutStepContainer = document.getElementById( + 'commerceCheckoutStepContainer' + ); + + const newInput = document.createElement('input'); + + const inputName = + '_com_liferay_commerce_checkout_web_internal_portlet_CommerceCheckoutPortlet_pon'; + + newInput.setAttribute('id', inputName); + newInput.setAttribute('name', inputName); + + newInput.setAttribute('placeholder', 'Purchase order number'); + newInput.setAttribute('type', 'text'); + + commerceCheckoutStepContainer.appendChild(newInput); +} diff --git a/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/build.gradle b/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/build.gradle new file mode 100644 index 0000000..d841557 --- /dev/null +++ b/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/build.gradle @@ -0,0 +1,40 @@ +buildscript { + dependencies { + classpath group: "com.liferay", name: "com.liferay.gradle.plugins.defaults", version: "latest.release" + classpath group: "org.springframework.boot", name: "spring-boot-gradle-plugin", version: "2.7.18" + } + + repositories { + maven { + url new File(rootProject.projectDir, "../../.m2-tmp") + } + + maven { + url "https://repository-cdn.liferay.com/nexus/content/groups/public" + } + } +} + +apply plugin: "com.liferay.source.formatter" +apply plugin: "java-library" +apply plugin: "org.springframework.boot" + +dependencies { + implementation group: "com.liferay", name: "com.liferay.client.extension.util.spring.boot", version: "latest.release" + implementation group: "com.liferay", name: "com.liferay.petra.string", version: "5.3.4" + implementation group: "com.liferay", name: "org.apache.commons.logging", version: "1.2.LIFERAY-PATCHED-2" + implementation group: "org.json", name: "json", version: "20231013" + implementation group: "org.springframework.boot", name: "spring-boot-starter-oauth2-resource-server", version: "2.7.18" + implementation group: "org.springframework.boot", name: "spring-boot-starter-web", version: "2.7.18" + implementation group: "org.springframework.boot", name: "spring-boot-starter-webflux", version: "2.7.18" +} + +repositories { + maven { + url new File(rootProject.projectDir, "../../.m2-tmp") + } + + maven { + url "https://repository-cdn.liferay.com/nexus/content/groups/public" + } +} \ No newline at end of file diff --git a/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/client-extension.yaml b/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/client-extension.yaml new file mode 100644 index 0000000..71dd577 --- /dev/null +++ b/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/client-extension.yaml @@ -0,0 +1,23 @@ +assemble: + - from: assets + into: static + - fromTask: bootJar +liferay-sample-commerce-checkout-step: + active: true + checkoutStepLabel: liferay-sample-commerce-checkout-step-label + checkoutStepName: liferay-sample-commerce-checkout-step-name + checkoutStepOrder: 25 + name: Liferay Sample Commerce Checkout Step + oAuth2ApplicationExternalReferenceCode: liferay-sample-commerce-checkout-step-oauth-application-user-agent + order: true + sennaDisabled: true + showControls: true + type: commerceCheckoutStep + visible: true +liferay-sample-commerce-checkout-step-oauth-application-user-agent: + .serviceAddress: localhost:58081 + .serviceScheme: http + name: Liferay Sample Commerce Checkout Step OAuth Application User Agent + scopes: + - Liferay.Headless.Admin.Workflow.everything + type: oAuthApplicationUserAgent \ No newline at end of file diff --git a/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/package.json b/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/package.json new file mode 100644 index 0000000..206ecfe --- /dev/null +++ b/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/package.json @@ -0,0 +1,13 @@ +{ + "dependencies": { + "react": "16.12.0", + "serve": "^14.2.0" + }, + "description": "Liferay Sample Commerce Checkout Step", + "name": "liferay-sample-commerce-checkout-step", + "type": "module", + "version": "1.0.0", + "workspaces": [ + "src/main/resources/assets/liferay-sample-commerce-checkout-step" + ] +} diff --git a/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/src/main/java/com/liferay/sample/ActionRestController.java b/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/src/main/java/com/liferay/sample/ActionRestController.java new file mode 100644 index 0000000..6d52c0e --- /dev/null +++ b/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/src/main/java/com/liferay/sample/ActionRestController.java @@ -0,0 +1,62 @@ +/** + * SPDX-FileCopyrightText: (c) 2024 Liferay, Inc. https://liferay.com + * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06 + */ + +package com.liferay.sample; + +import com.liferay.petra.string.StringBundler; + +import org.json.JSONObject; + +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.security.core.annotation.AuthenticationPrincipal; +import org.springframework.security.oauth2.jwt.Jwt; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.reactive.function.client.WebClient; + +/** + * @author Andrea Sbarra + */ +@RequestMapping("/action") +@RestController +public class ActionRestController extends BaseRestController { + + @PostMapping + public ResponseEntity post( + @AuthenticationPrincipal Jwt jwt, @RequestBody String json) { + + JSONObject jsonObject = new JSONObject(json); + + return new ResponseEntity<>( + WebClient.create( + StringBundler.concat( + lxcDXPServerProtocol, "://", lxcDXPMainDomain, + "/o/headless-commerce-delivery-cart/v1.0/carts/", + jsonObject.getLong("commerceOrderId")) + ).patch( + ).accept( + MediaType.APPLICATION_JSON + ).contentType( + MediaType.APPLICATION_JSON + ).bodyValue( + new JSONObject( + ).put( + "purchaseOrderNumber", jsonObject.getString("pon") + ).toString() + ).header( + HttpHeaders.AUTHORIZATION, "Bearer " + jwt.getTokenValue() + ).retrieve( + ).bodyToMono( + String.class + ).block(), + HttpStatus.OK); + } + +} \ No newline at end of file diff --git a/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/src/main/java/com/liferay/sample/BaseRestController.java b/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/src/main/java/com/liferay/sample/BaseRestController.java new file mode 100644 index 0000000..15b6812 --- /dev/null +++ b/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/src/main/java/com/liferay/sample/BaseRestController.java @@ -0,0 +1,64 @@ +/** + * SPDX-FileCopyrightText: (c) 2024 Liferay, Inc. https://liferay.com + * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06 + */ + +package com.liferay.sample; + +import java.util.Map; + +import org.apache.commons.logging.Log; + +import org.json.JSONObject; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.security.oauth2.jwt.Jwt; + +/** + * @author Raymond Augé + * @author Gregory Amerson + * @author Brian Wing Shun Chan + */ +public abstract class BaseRestController { + + protected void log(Jwt jwt, Log log) { + if (log.isInfoEnabled()) { + log.info("JWT Claims: " + jwt.getClaims()); + log.info("JWT ID: " + jwt.getId()); + log.info("JWT Subject: " + jwt.getSubject()); + } + } + + protected void log(Jwt jwt, Log log, Map parameters) { + if (log.isInfoEnabled()) { + log.info("JWT Claims: " + jwt.getClaims()); + log.info("JWT ID: " + jwt.getId()); + log.info("JWT Subject: " + jwt.getSubject()); + log.info("Parameters: " + parameters); + } + } + + protected void log(Jwt jwt, Log log, String json) { + if (log.isInfoEnabled()) { + try { + JSONObject jsonObject = new JSONObject(json); + + log.info("JSON: " + jsonObject.toString(4)); + } + catch (Exception exception) { + log.error("JSON: " + json, exception); + } + + log.info("JWT Claims: " + jwt.getClaims()); + log.info("JWT ID: " + jwt.getId()); + log.info("JWT Subject: " + jwt.getSubject()); + } + } + + @Value("${com.liferay.lxc.dxp.mainDomain}") + protected String lxcDXPMainDomain; + + @Value("${com.liferay.lxc.dxp.server.protocol}") + protected String lxcDXPServerProtocol; + +} \ No newline at end of file diff --git a/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/src/main/java/com/liferay/sample/ReadyRestController.java b/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/src/main/java/com/liferay/sample/ReadyRestController.java new file mode 100644 index 0000000..ea39517 --- /dev/null +++ b/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/src/main/java/com/liferay/sample/ReadyRestController.java @@ -0,0 +1,26 @@ +/** + * SPDX-FileCopyrightText: (c) 2024 Liferay, Inc. https://liferay.com + * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06 + */ + +package com.liferay.sample; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author Raymond Augé + * @author Gregory Amerson + * @author Brian Wing Shun Chan + */ +@RequestMapping("/ready") +@RestController +public class ReadyRestController extends BaseRestController { + + @GetMapping + public String get() { + return "READY"; + } + +} \ No newline at end of file diff --git a/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/src/main/java/com/liferay/sample/SampleSpringBootApplication.java b/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/src/main/java/com/liferay/sample/SampleSpringBootApplication.java new file mode 100644 index 0000000..6809d71 --- /dev/null +++ b/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/src/main/java/com/liferay/sample/SampleSpringBootApplication.java @@ -0,0 +1,27 @@ +/** + * SPDX-FileCopyrightText: (c) 2024 Liferay, Inc. https://liferay.com + * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06 + */ + +package com.liferay.sample; + +import com.liferay.client.extension.util.spring.boot.ClientExtensionUtilSpringBootComponentScan; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Import; + +/** + * @author Raymond Augé + * @author Gregory Amerson + * @author Brian Wing Shun Chan + */ +@Import(ClientExtensionUtilSpringBootComponentScan.class) +@SpringBootApplication +public class SampleSpringBootApplication { + + public static void main(String[] args) { + SpringApplication.run(SampleSpringBootApplication.class, args); + } + +} \ No newline at end of file diff --git a/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/src/main/resources/application-default.properties b/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/src/main/resources/application-default.properties new file mode 100644 index 0000000..c53790b --- /dev/null +++ b/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/src/main/resources/application-default.properties @@ -0,0 +1,20 @@ +# +# LXC +# + +com.liferay.lxc.dxp.domains=localhost:8080 +com.liferay.lxc.dxp.mainDomain=localhost:8080 +com.liferay.lxc.dxp.server.protocol=http + +# +# OAuth +# + +liferay.oauth.application.external.reference.codes=liferay-sample-commerce-checkout-step-oauth-application-user-agent +liferay.oauth.urls.excludes=/ready + +# +# Spring Boot +# + +server.port=58081 \ No newline at end of file diff --git a/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/src/main/resources/application.properties b/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/src/main/resources/application.properties new file mode 100644 index 0000000..a3ce9f1 --- /dev/null +++ b/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-checkout-step/src/main/resources/application.properties @@ -0,0 +1,4 @@ +spring.config.import=\ + classpath:/application-default.properties,\ + optional:configtree:${LIFERAY_ROUTES_CLIENT_EXTENSION}/,\ + optional:configtree:${LIFERAY_ROUTES_DXP}/ \ No newline at end of file diff --git a/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-payment-integration/src/main/java/com/liferay/sample/AuthorizeRestController.java b/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-payment-integration/src/main/java/com/liferay/sample/AuthorizeRestController.java index 1e8d13c..66cdaee 100644 --- a/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-payment-integration/src/main/java/com/liferay/sample/AuthorizeRestController.java +++ b/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-payment-integration/src/main/java/com/liferay/sample/AuthorizeRestController.java @@ -5,6 +5,8 @@ package com.liferay.sample; +import java.util.UUID; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -32,11 +34,14 @@ public ResponseEntity post( log(jwt, _log, json); - JSONObject jsonObject = new JSONObject(); - - jsonObject.put("paymentStatus", 2); - - return new ResponseEntity<>(jsonObject.toString(), HttpStatus.OK); + return new ResponseEntity<>( + new JSONObject( + ).put( + "paymentStatus", 2 + ).put( + "transactionCode", UUID.randomUUID() + ).toString(), + HttpStatus.OK); } private static final Log _log = LogFactory.getLog( diff --git a/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-payment-integration/src/main/java/com/liferay/sample/CancelRestController.java b/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-payment-integration/src/main/java/com/liferay/sample/CancelRestController.java index 0a84e8a..d201abd 100644 --- a/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-payment-integration/src/main/java/com/liferay/sample/CancelRestController.java +++ b/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-payment-integration/src/main/java/com/liferay/sample/CancelRestController.java @@ -32,11 +32,12 @@ public ResponseEntity post( log(jwt, _log, json); - JSONObject jsonObject = new JSONObject(); - - jsonObject.put("paymentStatus", 8); - - return new ResponseEntity<>(jsonObject.toString(), HttpStatus.OK); + return new ResponseEntity<>( + new JSONObject( + ).put( + "paymentStatus", 8 + ).toString(), + HttpStatus.OK); } private static final Log _log = LogFactory.getLog( diff --git a/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-payment-integration/src/main/java/com/liferay/sample/CaptureRestController.java b/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-payment-integration/src/main/java/com/liferay/sample/CaptureRestController.java index d445423..d81dcca 100644 --- a/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-payment-integration/src/main/java/com/liferay/sample/CaptureRestController.java +++ b/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-payment-integration/src/main/java/com/liferay/sample/CaptureRestController.java @@ -32,11 +32,12 @@ public ResponseEntity post( log(jwt, _log, json); - JSONObject jsonObject = new JSONObject(); - - jsonObject.put("paymentStatus", 0); - - return new ResponseEntity<>(jsonObject.toString(), HttpStatus.OK); + return new ResponseEntity<>( + new JSONObject( + ).put( + "paymentStatus", 0 + ).toString(), + HttpStatus.OK); } private static final Log _log = LogFactory.getLog( diff --git a/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-payment-integration/src/main/java/com/liferay/sample/RefundRestController.java b/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-payment-integration/src/main/java/com/liferay/sample/RefundRestController.java index e94d3b7..0ef8c3e 100644 --- a/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-payment-integration/src/main/java/com/liferay/sample/RefundRestController.java +++ b/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-payment-integration/src/main/java/com/liferay/sample/RefundRestController.java @@ -32,11 +32,12 @@ public ResponseEntity post( log(jwt, _log, json); - JSONObject jsonObject = new JSONObject(); - - jsonObject.put("paymentStatus", 17); - - return new ResponseEntity<>(jsonObject.toString(), HttpStatus.OK); + return new ResponseEntity<>( + new JSONObject( + ).put( + "paymentStatus", 17 + ).toString(), + HttpStatus.OK); } private static final Log _log = LogFactory.getLog( diff --git a/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-payment-integration/src/main/java/com/liferay/sample/SetUpPaymentRestController.java b/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-payment-integration/src/main/java/com/liferay/sample/SetUpPaymentRestController.java index b793f46..761c0af 100644 --- a/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-payment-integration/src/main/java/com/liferay/sample/SetUpPaymentRestController.java +++ b/lfr/pkg/assets/tpl/cx/liferay-portal/workspaces/liferay-sample-workspace/client-extensions/liferay-sample-commerce-payment-integration/src/main/java/com/liferay/sample/SetUpPaymentRestController.java @@ -32,11 +32,12 @@ public ResponseEntity post( log(jwt, _log, json); - JSONObject jsonObject = new JSONObject(); - - jsonObject.put("paymentStatus", 18); - - return new ResponseEntity<>(jsonObject.toString(), HttpStatus.OK); + return new ResponseEntity<>( + new JSONObject( + ).put( + "paymentStatus", 18 + ).toString(), + HttpStatus.OK); } private static final Log _log = LogFactory.getLog(