diff --git a/adyensubscriptionb2caddon/resources/adyensubscriptionb2caddon-items.xml b/adyensubscriptionb2caddon/resources/adyensubscriptionb2caddon-items.xml
index 9f659605f..f5779faaf 100644
--- a/adyensubscriptionb2caddon/resources/adyensubscriptionb2caddon-items.xml
+++ b/adyensubscriptionb2caddon/resources/adyensubscriptionb2caddon-items.xml
@@ -1,7 +1,7 @@
-
-
-
-
- Shows a CMS item only while a subscription billing platform connector is loaded.
-
-
-
-
-
-
-
-
diff --git a/adyensubscriptionb2caddon/resources/adyensubscriptionb2caddon-spring.xml b/adyensubscriptionb2caddon/resources/adyensubscriptionb2caddon-spring.xml
index ee63747fd..18ec609f0 100644
--- a/adyensubscriptionb2caddon/resources/adyensubscriptionb2caddon-spring.xml
+++ b/adyensubscriptionb2caddon/resources/adyensubscriptionb2caddon-spring.xml
@@ -11,8 +11,7 @@
@@ -32,22 +31,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/adyensubscriptionb2caddon/resources/localization/adyensubscriptionb2caddon-locales_en.properties b/adyensubscriptionb2caddon/resources/localization/adyensubscriptionb2caddon-locales_en.properties
index e55e72f1b..c3381b949 100644
--- a/adyensubscriptionb2caddon/resources/localization/adyensubscriptionb2caddon-locales_en.properties
+++ b/adyensubscriptionb2caddon/resources/localization/adyensubscriptionb2caddon-locales_en.properties
@@ -1,4 +1,2 @@
# Copyright (c) 2026 Adyen B.V. - MIT license.
-type.AdyenSubscriptionPlatformRestriction.name=Subscription Platform Loaded Restriction
-type.AdyenSubscriptionPlatformRestriction.description=Shows a CMS item only while a subscription billing platform connector is loaded
diff --git a/adyensubscriptionconnector/extensioninfo.xml b/adyensubscriptionconnector/extensioninfo.xml
index fbc504691..d61e8af08 100644
--- a/adyensubscriptionconnector/extensioninfo.xml
+++ b/adyensubscriptionconnector/extensioninfo.xml
@@ -22,6 +22,8 @@
+
+
diff --git a/adyensubscriptionconnector/project.properties b/adyensubscriptionconnector/project.properties
index 6ac62029b..ee031def5 100644
--- a/adyensubscriptionconnector/project.properties
+++ b/adyensubscriptionconnector/project.properties
@@ -46,3 +46,9 @@ adyen.subscription.retention.settledAfterDays=30
adyen.subscription.retention.troubledAfterDays=180
# Per run, per journal. Kept modest because this competes with live traffic.
adyen.subscription.retention.job.batchSize=500
+
+# --- OCC error mapping for the shopper subscriptions endpoint ---------------------------------------
+# The refusal is one fixed 400 whatever the reason; the stack is never logged (nothing useful is in it).
+webservicescommons.resthandlerexceptionresolver.SubscriptionActionRefusedException.status=400
+webservicescommons.resthandlerexceptionresolver.SubscriptionActionRefusedException.logstack=false
+webservicescommons.resthandlerexceptionresolver.SubscriptionActionRefusedException.messageFormatterType=FORWARD
diff --git a/adyensubscriptionconnector/resources/adyensubscriptionconnector-items.xml b/adyensubscriptionconnector/resources/adyensubscriptionconnector-items.xml
index f9ea4b2b6..d09857cdf 100644
--- a/adyensubscriptionconnector/resources/adyensubscriptionconnector-items.xml
+++ b/adyensubscriptionconnector/resources/adyensubscriptionconnector-items.xml
@@ -53,6 +53,26 @@
+
+
+
+ Shows a CMS item only while a subscription billing platform connector is loaded.
+
+
+
+
+
+
+
+
diff --git a/adyensubscriptionconnector/resources/adyensubscriptionconnector-spring.xml b/adyensubscriptionconnector/resources/adyensubscriptionconnector-spring.xml
index 6e7489d9c..380269a1d 100644
--- a/adyensubscriptionconnector/resources/adyensubscriptionconnector-spring.xml
+++ b/adyensubscriptionconnector/resources/adyensubscriptionconnector-spring.xml
@@ -312,4 +312,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/adyensubscriptionconnector/resources/adyensubscriptionconnector/import/spartacus/cms-content.impex b/adyensubscriptionconnector/resources/adyensubscriptionconnector/import/spartacus/cms-content.impex
new file mode 100644
index 000000000..91957b632
--- /dev/null
+++ b/adyensubscriptionconnector/resources/adyensubscriptionconnector/import/spartacus/cms-content.impex
@@ -0,0 +1,105 @@
+# -----------------------------------------------------------------------
+# The "My Subscriptions" page in My Account for the Spartacus storefront.
+#
+# NOT imported automatically: nothing in SystemSetup runs this file. Import it by hand in HAC
+# (Console > ImpEx import) after the system update that creates the AdyenSubscriptionPlatformRestriction
+# type, which this connector now owns. The Accelerator addon has its own impex for its own catalogue.
+#
+# Targets the Spartacus content catalogue of the sample data (electronics-spaContentCatalog). For another
+# site change $contentCatalog below. It is idempotent: INSERT_UPDATE with unique keys, and `append` mode on
+# the links of the restriction and the navigation nodes.
+#
+# What it creates, in BOTH catalogue versions (Spartacus serves Online, so a Staged-only import is
+# invisible until somebody synchronises the catalogue):
+# 1. ContentPage adyenSubscriptions, label /my-account/subscriptions, on AccountPageTemplate
+# 2. a CMSFlexComponent whose flexType AdyenMySubscriptionsComponent is the key of
+# cmsComponents in @adyen/adyen-spartacus, placed in the BodyContent slot of that page
+# 3. a "Subscriptions" link with a restriction that lets it through only while a billing platform
+# connector is loaded, and two navigation entries for it: the My Account dropdown
+# (MyAccountNavNode) and the My Account side navigation (OrderInformationNavNode, created by
+# spartacussampledata/myaccount-navigation.impex)
+#
+# The &...Staged and &...Online document ids are scoped to the whole import run, so the two halves must
+# not share one.
+# -----------------------------------------------------------------------
+$contentCatalog=electronics-spaContentCatalog
+$contentCVS=catalogVersion(CatalogVersion.catalog(Catalog.id[default=$contentCatalog]),CatalogVersion.version[default=Staged])[default=$contentCatalog:Staged]
+$contentCVO=catalogVersion(CatalogVersion.catalog(Catalog.id[default=$contentCatalog]),CatalogVersion.version[default=Online])[default=$contentCatalog:Online]
+
+# --- Staged ---
+INSERT_UPDATE ContentPage;$contentCVS[unique=true];uid[unique=true];name;masterTemplate(uid,$contentCVS);label;defaultPage[default='true'];approvalStatus(code)[default='approved'];homepage[default='false']
+;;adyenSubscriptions;My Subscriptions Page;AccountPageTemplate;/my-account/subscriptions
+
+INSERT_UPDATE CMSFlexComponent;$contentCVS[unique=true];uid[unique=true];name;flexType
+;;AdyenMySubscriptionsComponent;Adyen My Subscriptions Component;AdyenMySubscriptionsComponent
+
+INSERT_UPDATE ContentSlot;$contentCVS[unique=true];uid[unique=true];name;active;cmsComponents(uid,$contentCVS)
+;;BodyContent-adyenSubscriptions;Body Content Slot for My Subscriptions;true;AdyenMySubscriptionsComponent
+
+INSERT_UPDATE ContentSlotForPage;$contentCVS[unique=true];uid[unique=true];position[unique=true];page(uid,$contentCVS)[unique=true][default='adyenSubscriptions'];contentSlot(uid,$contentCVS)[unique=true]
+;;BodyContent-adyenSubscriptions;BodyContent;;BodyContent-adyenSubscriptions
+
+INSERT_UPDATE AdyenSubscriptionPlatformRestriction;$contentCVS[unique=true];uid[unique=true];name
+;;AdyenSubscriptionPlatformRestriction;Subscription billing platform loaded
+
+INSERT_UPDATE CMSLinkComponent;$contentCVS[unique=true];uid[unique=true];name;url;&linkRefStaged;target(code)[default='sameWindow'];restrictions(uid,$contentCVS)[mode=append]
+;;AdyenSubscriptionsLink;AdyenSubscriptionsLink;/my-account/subscriptions;AdyenSubscriptionsLink;;AdyenSubscriptionPlatformRestriction
+
+UPDATE CMSLinkComponent;$contentCVS[unique=true];uid[unique=true];linkName[lang=en]
+;;AdyenSubscriptionsLink;"Subscriptions"
+
+# `links` stays empty on purpose: the CMSNavigationEntry binds the link, and filling both would show it twice.
+INSERT_UPDATE CMSNavigationNode;uid[unique=true];$contentCVS[unique=true];name;parent(uid,$contentCVS);&nodeRefStaged;title[lang=en]
+;AdyenSubscriptionsNavNode;;Subscriptions;MyAccountNavNode;AdyenSubscriptionsNavNode;Subscriptions
+;AdyenSubscriptionsSideNavNode;;Subscriptions;OrderInformationNavNode;AdyenSubscriptionsSideNavNode;Subscriptions
+
+INSERT_UPDATE CMSNavigationEntry;uid[unique=true];$contentCVS[unique=true];name;navigationNode(&nodeRefStaged);item(&linkRefStaged)
+;AdyenSubscriptionsNavNodeEntry;;AdyenSubscriptionsNavNodeEntry;AdyenSubscriptionsNavNode;AdyenSubscriptionsLink
+;AdyenSubscriptionsSideNavNodeEntry;;AdyenSubscriptionsSideNavNodeEntry;AdyenSubscriptionsSideNavNode;AdyenSubscriptionsLink
+
+# The new node is appended to MyAccountNavNode, i.e. after Sign Out. Re-attach Sign Out so it moves back to
+# the end: detaching and re-attaching a child appends it to the ordered children of the parent. Unlike
+# re-setting the whole children list this does not depend on which other nodes a project has.
+UPDATE CMSNavigationNode;uid[unique=true];$contentCVS[unique=true];parent(uid,$contentCVS)[allownull=true]
+;SignOutNavNode;;
+UPDATE CMSNavigationNode;uid[unique=true];$contentCVS[unique=true];parent(uid,$contentCVS)
+;SignOutNavNode;;MyAccountNavNode
+
+# --- Online ---
+INSERT_UPDATE ContentPage;$contentCVO[unique=true];uid[unique=true];name;masterTemplate(uid,$contentCVO);label;defaultPage[default='true'];approvalStatus(code)[default='approved'];homepage[default='false']
+;;adyenSubscriptions;My Subscriptions Page;AccountPageTemplate;/my-account/subscriptions
+
+INSERT_UPDATE CMSFlexComponent;$contentCVO[unique=true];uid[unique=true];name;flexType
+;;AdyenMySubscriptionsComponent;Adyen My Subscriptions Component;AdyenMySubscriptionsComponent
+
+INSERT_UPDATE ContentSlot;$contentCVO[unique=true];uid[unique=true];name;active;cmsComponents(uid,$contentCVO)
+;;BodyContent-adyenSubscriptions;Body Content Slot for My Subscriptions;true;AdyenMySubscriptionsComponent
+
+INSERT_UPDATE ContentSlotForPage;$contentCVO[unique=true];uid[unique=true];position[unique=true];page(uid,$contentCVO)[unique=true][default='adyenSubscriptions'];contentSlot(uid,$contentCVO)[unique=true]
+;;BodyContent-adyenSubscriptions;BodyContent;;BodyContent-adyenSubscriptions
+
+INSERT_UPDATE AdyenSubscriptionPlatformRestriction;$contentCVO[unique=true];uid[unique=true];name
+;;AdyenSubscriptionPlatformRestriction;Subscription billing platform loaded
+
+INSERT_UPDATE CMSLinkComponent;$contentCVO[unique=true];uid[unique=true];name;url;&linkRefOnline;target(code)[default='sameWindow'];restrictions(uid,$contentCVO)[mode=append]
+;;AdyenSubscriptionsLink;AdyenSubscriptionsLink;/my-account/subscriptions;AdyenSubscriptionsLink;;AdyenSubscriptionPlatformRestriction
+
+UPDATE CMSLinkComponent;$contentCVO[unique=true];uid[unique=true];linkName[lang=en]
+;;AdyenSubscriptionsLink;"Subscriptions"
+
+# `links` stays empty on purpose: the CMSNavigationEntry binds the link, and filling both would show it twice.
+INSERT_UPDATE CMSNavigationNode;uid[unique=true];$contentCVO[unique=true];name;parent(uid,$contentCVO);&nodeRefOnline;title[lang=en]
+;AdyenSubscriptionsNavNode;;Subscriptions;MyAccountNavNode;AdyenSubscriptionsNavNode;Subscriptions
+;AdyenSubscriptionsSideNavNode;;Subscriptions;OrderInformationNavNode;AdyenSubscriptionsSideNavNode;Subscriptions
+
+INSERT_UPDATE CMSNavigationEntry;uid[unique=true];$contentCVO[unique=true];name;navigationNode(&nodeRefOnline);item(&linkRefOnline)
+;AdyenSubscriptionsNavNodeEntry;;AdyenSubscriptionsNavNodeEntry;AdyenSubscriptionsNavNode;AdyenSubscriptionsLink
+;AdyenSubscriptionsSideNavNodeEntry;;AdyenSubscriptionsSideNavNodeEntry;AdyenSubscriptionsSideNavNode;AdyenSubscriptionsLink
+
+# The new node is appended to MyAccountNavNode, i.e. after Sign Out. Re-attach Sign Out so it moves back to
+# the end: detaching and re-attaching a child appends it to the ordered children of the parent. Unlike
+# re-setting the whole children list this does not depend on which other nodes a project has.
+UPDATE CMSNavigationNode;uid[unique=true];$contentCVO[unique=true];parent(uid,$contentCVO)[allownull=true]
+;SignOutNavNode;;
+UPDATE CMSNavigationNode;uid[unique=true];$contentCVO[unique=true];parent(uid,$contentCVO)
+;SignOutNavNode;;MyAccountNavNode
diff --git a/adyensubscriptionconnector/resources/localization/adyensubscriptionconnector-locales_en.properties b/adyensubscriptionconnector/resources/localization/adyensubscriptionconnector-locales_en.properties
index 76506c599..7ddb5c02d 100644
--- a/adyensubscriptionconnector/resources/localization/adyensubscriptionconnector-locales_en.properties
+++ b/adyensubscriptionconnector/resources/localization/adyensubscriptionconnector-locales_en.properties
@@ -86,3 +86,6 @@ type.AdyenSubscriptionConfig.adyenGatewayMerchantAccount.description=The Adyen m
type.Customer.billingCustomerRefs.name=Billing Customer References
type.PaymentInfo.billingPaymentMethodRefs.name=Billing Payment Method References
+
+type.AdyenSubscriptionPlatformRestriction.name=Subscription Platform Loaded Restriction
+type.AdyenSubscriptionPlatformRestriction.description=Shows a CMS item only while a subscription billing platform connector is loaded
diff --git a/adyensubscriptionconnector/resources/occ/v2/subscriptionbillingocc/web/spring/subscriptionbillingocc-web-spring.xml b/adyensubscriptionconnector/resources/occ/v2/subscriptionbillingocc/web/spring/subscriptionbillingocc-web-spring.xml
index 5311030a5..ebc81ff5d 100644
--- a/adyensubscriptionconnector/resources/occ/v2/subscriptionbillingocc/web/spring/subscriptionbillingocc-web-spring.xml
+++ b/adyensubscriptionconnector/resources/occ/v2/subscriptionbillingocc/web/spring/subscriptionbillingocc-web-spring.xml
@@ -35,4 +35,9 @@
+
+
+
+
diff --git a/adyensubscriptionb2caddon/src/com/adyen/commerce/subscription/jalo/AdyenSubscriptionPlatformRestriction.java b/adyensubscriptionconnector/src/com/adyen/commerce/connector/jalo/AdyenSubscriptionPlatformRestriction.java
similarity index 51%
rename from adyensubscriptionb2caddon/src/com/adyen/commerce/subscription/jalo/AdyenSubscriptionPlatformRestriction.java
rename to adyensubscriptionconnector/src/com/adyen/commerce/connector/jalo/AdyenSubscriptionPlatformRestriction.java
index 913e35ed2..7b7b0f81b 100644
--- a/adyensubscriptionb2caddon/src/com/adyen/commerce/subscription/jalo/AdyenSubscriptionPlatformRestriction.java
+++ b/adyensubscriptionconnector/src/com/adyen/commerce/connector/jalo/AdyenSubscriptionPlatformRestriction.java
@@ -5,17 +5,22 @@
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
-package com.adyen.commerce.subscription.jalo;
+package com.adyen.commerce.connector.jalo;
-import com.adyen.commerce.subscription.restrictions.SubscriptionPlatformRestrictionDescriptionHandler;
+import com.adyen.commerce.connector.restrictions.SubscriptionPlatformRestrictionDescriptionHandler;
+import de.hybris.platform.cms2.jalo.restrictions.AbstractRestriction;
import de.hybris.platform.jalo.SessionContext;
/**
* Jalo class of the restriction, required by the type system. The service layer reads the description through
* {@link SubscriptionPlatformRestrictionDescriptionHandler}; this returns the same sentence for jalo callers.
+ *
+ *
Hand-written and not generated (the type is {@code generate="false"}): in a jaloLogicFree extension the
+ * generator writes the jalo class itself into gensrc, where it could not implement the abstract
+ * {@link AbstractRestriction#getDescription(SessionContext)}.
*/
-public class AdyenSubscriptionPlatformRestriction extends GeneratedAdyenSubscriptionPlatformRestriction
+public class AdyenSubscriptionPlatformRestriction extends AbstractRestriction
{
@Override
public String getDescription(final SessionContext ctx)
diff --git a/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/controllers/AdyenMySubscriptionsController.java b/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/controllers/AdyenMySubscriptionsController.java
new file mode 100644
index 000000000..789f65fde
--- /dev/null
+++ b/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/controllers/AdyenMySubscriptionsController.java
@@ -0,0 +1,220 @@
+/*
+ * ######
+ * ######
+ * ############ ####( ###### #####. ###### ############ ############
+ * ############# #####( ###### #####. ###### ############# #############
+ * ###### #####( ###### #####. ###### ##### ###### ##### ######
+ * ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
+ * ###### ###### #####( ###### #####. ###### ##### ##### ######
+ * ############# ############# ############# ############# ##### ######
+ * ############ ############ ############# ############ ##### ######
+ * ######
+ * #############
+ * ############
+ *
+ * Adyen Hybris Extension
+ *
+ * Copyright (c) 2026 Adyen B.V.
+ * This file is open source and available under the MIT license.
+ * See the LICENSE file for more info.
+ */
+package com.adyen.commerce.connector.occ.controllers;
+
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.security.access.annotation.Secured;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+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.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import com.adyen.commerce.connector.facades.MySubscriptionsFacade;
+import com.adyen.commerce.connector.facades.data.PaymentMethodChangeReport;
+import com.adyen.commerce.connector.facades.data.PaymentMethodChangeResult;
+import com.adyen.commerce.connector.occ.dto.AdyenSubscriptionCancelResultWsDTO;
+import com.adyen.commerce.connector.occ.dto.AdyenSubscriptionEnrollmentUrlWsDTO;
+import com.adyen.commerce.connector.occ.dto.AdyenSubscriptionOverviewWsDTO;
+import com.adyen.commerce.connector.occ.dto.AdyenSubscriptionPaymentMethodChangeRequestWsDTO;
+import com.adyen.commerce.connector.occ.dto.AdyenSubscriptionPaymentMethodChangeResultWsDTO;
+import com.adyen.commerce.connector.occ.exceptions.SubscriptionActionRefusedException;
+import com.adyen.commerce.connector.occ.mapper.AdyenMySubscriptionsWsMapper;
+
+import de.hybris.platform.webservicescommons.cache.CacheControl;
+import de.hybris.platform.webservicescommons.cache.CacheControlDirective;
+import de.hybris.platform.webservicescommons.swagger.ApiBaseSiteIdAndUserIdParam;
+
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.annotation.Resource;
+
+/**
+ * The shopper's own subscriptions over OCC: the list, cancellation, change of payment method and the way
+ * to the billing platform's hosted payment method page. Thin over {@link MySubscriptionsFacade}, which
+ * scopes every call to the customer in session; the {@code {userId}} path segment together with OCC's
+ * user matching filter decides who that is.
+ *
+ *
Reads are open to the trusted client as well; the three actions are not, because that role skips the
+ * owner check. Every kind of refusal is the same 400 {@link SubscriptionActionRefusedException}, so a caller
+ * cannot tell a code that is not theirs from one in the wrong state. Nothing a billing platform said is
+ * passed on, and the enrollment address, which is a credential on some platforms, is never logged.
+ */
+@Controller
+@RequestMapping(value = "/{baseSiteId}/users/{userId}/adyen/subscriptions")
+@CacheControl(directive = CacheControlDirective.NO_CACHE)
+@Tag(name = "Adyen Subscriptions")
+public class AdyenMySubscriptionsController
+{
+ private static final Logger LOG = LoggerFactory.getLogger(AdyenMySubscriptionsController.class);
+
+ @Resource(name = "mySubscriptionsFacade")
+ private MySubscriptionsFacade mySubscriptionsFacade;
+
+ @Resource(name = "adyenMySubscriptionsWsMapper")
+ private AdyenMySubscriptionsWsMapper mapper;
+
+ @Secured({ "ROLE_CUSTOMERGROUP", "ROLE_CLIENT", "ROLE_CUSTOMERMANAGERGROUP", "ROLE_TRUSTED_CLIENT" })
+ @GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
+ @ResponseBody
+ @Operation(operationId = "getAdyenSubscriptions", summary = "Returns the subscriptions of the user",
+ description = "Returns the user's subscriptions grouped by billing platform, with the state of each and "
+ + "which actions are offered. Answers 404 when no billing platform connector is loaded.")
+ @ApiBaseSiteIdAndUserIdParam
+ public ResponseEntity getSubscriptions()
+ {
+ if (!mySubscriptionsFacade.hasAvailablePlatforms())
+ {
+ return ResponseEntity.notFound().build();
+ }
+ return ResponseEntity.ok(getMapper().toOverview(mySubscriptionsFacade.getSubscriptionsForCurrentCustomer()));
+ }
+
+ @Secured({ "ROLE_CUSTOMERGROUP", "ROLE_CUSTOMERMANAGERGROUP" })
+ @PostMapping(path = "/{code}/cancel", produces = MediaType.APPLICATION_JSON_VALUE)
+ @ResponseBody
+ @Operation(operationId = "cancelAdyenSubscription", summary = "Cancels a subscription at the end of the paid period",
+ description = "Refuses with the same 400 SubscriptionActionRefusedError whatever the reason.")
+ @ApiBaseSiteIdAndUserIdParam
+ public ResponseEntity cancel(@PathVariable final String code,
+ @RequestParam(value = "platform", required = false) final String platform)
+ {
+ if (!mySubscriptionsFacade.hasAvailablePlatforms())
+ {
+ return ResponseEntity.notFound().build();
+ }
+ final boolean cancelled;
+ try
+ {
+ cancelled = !StringUtils.isBlank(platform) && mySubscriptionsFacade.cancelForCurrentCustomer(platform, code);
+ }
+ catch (final RuntimeException e)
+ {
+ throw refused("cancel", e);
+ }
+ if (!cancelled)
+ {
+ throw new SubscriptionActionRefusedException();
+ }
+ return ResponseEntity.ok(new AdyenSubscriptionCancelResultWsDTO());
+ }
+
+ @Secured({ "ROLE_CUSTOMERGROUP", "ROLE_CUSTOMERMANAGERGROUP" })
+ @PostMapping(path = "/{code}/payment-method", consumes = MediaType.APPLICATION_JSON_VALUE,
+ produces = MediaType.APPLICATION_JSON_VALUE)
+ @ResponseBody
+ @Operation(operationId = "changeAdyenSubscriptionPaymentMethod", summary = "Changes the payment method of a subscription",
+ description = "Points billing at a payment method the user holds, for this subscription or for all "
+ + "subscriptions of the account. The body reports what happened as result, moved, failed and partial.")
+ @ApiBaseSiteIdAndUserIdParam
+ public ResponseEntity changePaymentMethod(
+ @PathVariable final String code,
+ @RequestBody final AdyenSubscriptionPaymentMethodChangeRequestWsDTO request)
+ {
+ if (!mySubscriptionsFacade.hasAvailablePlatforms())
+ {
+ return ResponseEntity.notFound().build();
+ }
+ if (request == null || StringUtils.isBlank(request.getPlatform())
+ || StringUtils.isBlank(request.getStoredPaymentMethodId()))
+ {
+ throw new SubscriptionActionRefusedException();
+ }
+ PaymentMethodChangeReport report;
+ try
+ {
+ report = request.isApplyToAll()
+ ? mySubscriptionsFacade.changePaymentMethodForAllSubscriptions(request.getPlatform(), code,
+ request.getStoredPaymentMethodId())
+ : PaymentMethodChangeReport.of(mySubscriptionsFacade.changePaymentMethodForCurrentCustomer(
+ request.getPlatform(), code, request.getStoredPaymentMethodId()));
+ }
+ catch (final RuntimeException e)
+ {
+ LOG.warn("Payment method change failed unexpectedly ({})", e.getClass().getSimpleName());
+ report = PaymentMethodChangeReport.of(PaymentMethodChangeResult.FAILED);
+ }
+ return ResponseEntity.ok(getMapper().toChangeResult(report));
+ }
+
+ @Secured({ "ROLE_CUSTOMERGROUP", "ROLE_CUSTOMERMANAGERGROUP" })
+ @PostMapping(path = "/{code}/payment-method/enrollment", produces = MediaType.APPLICATION_JSON_VALUE)
+ @ResponseBody
+ @Operation(operationId = "getAdyenSubscriptionPaymentMethodEnrollmentUrl",
+ summary = "Returns the address of the billing platform's payment method page",
+ description = "A POST and never cached: on some platforms the address carries a token that opens the "
+ + "account. Refuses with 400 SubscriptionActionRefusedError when there is none to give.")
+ @ApiBaseSiteIdAndUserIdParam
+ public ResponseEntity enrollment(@PathVariable final String code,
+ @RequestParam(value = "platform", required = false) final String platform)
+ {
+ if (!mySubscriptionsFacade.hasAvailablePlatforms())
+ {
+ return ResponseEntity.notFound().build();
+ }
+ final String url;
+ try
+ {
+ url = StringUtils.isBlank(platform) ? null
+ : mySubscriptionsFacade.paymentMethodEnrollmentUrlForCurrentCustomer(platform, code);
+ }
+ catch (final RuntimeException e)
+ {
+ throw refused("enrollment", e);
+ }
+ if (StringUtils.isBlank(url))
+ {
+ throw new SubscriptionActionRefusedException();
+ }
+ final AdyenSubscriptionEnrollmentUrlWsDTO body = new AdyenSubscriptionEnrollmentUrlWsDTO();
+ body.setUrl(url);
+ return ResponseEntity.ok(body);
+ }
+
+ /** Logs the kind of failure only: its message may quote the platform, or the address. */
+ protected SubscriptionActionRefusedException refused(final String action, final RuntimeException cause)
+ {
+ LOG.warn("Subscription {} failed unexpectedly ({})", action, cause.getClass().getSimpleName());
+ return new SubscriptionActionRefusedException();
+ }
+
+ protected AdyenMySubscriptionsWsMapper getMapper()
+ {
+ return mapper;
+ }
+
+ public void setMySubscriptionsFacade(final MySubscriptionsFacade mySubscriptionsFacade)
+ {
+ this.mySubscriptionsFacade = mySubscriptionsFacade;
+ }
+
+ public void setMapper(final AdyenMySubscriptionsWsMapper mapper)
+ {
+ this.mapper = mapper;
+ }
+}
diff --git a/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/dto/AdyenSubscriptionCancelResultWsDTO.java b/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/dto/AdyenSubscriptionCancelResultWsDTO.java
new file mode 100644
index 000000000..5e6a583a0
--- /dev/null
+++ b/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/dto/AdyenSubscriptionCancelResultWsDTO.java
@@ -0,0 +1,31 @@
+/*
+ * ######
+ * ######
+ * ############ ####( ###### #####. ###### ############ ############
+ * ############# #####( ###### #####. ###### ############# #############
+ * ###### #####( ###### #####. ###### ##### ###### ##### ######
+ * ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
+ * ###### ###### #####( ###### #####. ###### ##### ##### ######
+ * ############# ############# ############# ############# ##### ######
+ * ############ ############ ############# ############ ##### ######
+ * ######
+ * #############
+ * ############
+ *
+ * Adyen Hybris Extension
+ *
+ * Copyright (c) 2026 Adyen B.V.
+ * This file is open source and available under the MIT license.
+ * See the LICENSE file for more info.
+ */
+package com.adyen.commerce.connector.occ.dto;
+
+import java.io.Serializable;
+
+/**
+ * Empty body of a successful cancellation.
+ */
+public class AdyenSubscriptionCancelResultWsDTO implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+}
diff --git a/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/dto/AdyenSubscriptionChangeOfferWsDTO.java b/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/dto/AdyenSubscriptionChangeOfferWsDTO.java
new file mode 100644
index 000000000..7623a8ce2
--- /dev/null
+++ b/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/dto/AdyenSubscriptionChangeOfferWsDTO.java
@@ -0,0 +1,81 @@
+/*
+ * ######
+ * ######
+ * ############ ####( ###### #####. ###### ############ ############
+ * ############# #####( ###### #####. ###### ############# #############
+ * ###### #####( ###### #####. ###### ##### ###### ##### ######
+ * ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
+ * ###### ###### #####( ###### #####. ###### ##### ##### ######
+ * ############# ############# ############# ############# ##### ######
+ * ############ ############ ############# ############ ##### ######
+ * ######
+ * #############
+ * ############
+ *
+ * Adyen Hybris Extension
+ *
+ * Copyright (c) 2026 Adyen B.V.
+ * This file is open source and available under the MIT license.
+ * See the LICENSE file for more info.
+ */
+package com.adyen.commerce.connector.occ.dto;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * An account-wide payment method change on one billing account.
+ */
+public class AdyenSubscriptionChangeOfferWsDTO implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private String subscriptionCode;
+
+ private String accountName;
+
+ private List paymentMethodOptions = new ArrayList<>();
+
+ private List adyenVaultOptions = new ArrayList<>();
+
+ public String getSubscriptionCode()
+ {
+ return subscriptionCode;
+ }
+
+ public void setSubscriptionCode(final String subscriptionCode)
+ {
+ this.subscriptionCode = subscriptionCode;
+ }
+
+ public String getAccountName()
+ {
+ return accountName;
+ }
+
+ public void setAccountName(final String accountName)
+ {
+ this.accountName = accountName;
+ }
+
+ public List getPaymentMethodOptions()
+ {
+ return paymentMethodOptions;
+ }
+
+ public void setPaymentMethodOptions(final List paymentMethodOptions)
+ {
+ this.paymentMethodOptions = paymentMethodOptions == null ? new ArrayList<>() : paymentMethodOptions;
+ }
+
+ public List getAdyenVaultOptions()
+ {
+ return adyenVaultOptions;
+ }
+
+ public void setAdyenVaultOptions(final List adyenVaultOptions)
+ {
+ this.adyenVaultOptions = adyenVaultOptions == null ? new ArrayList<>() : adyenVaultOptions;
+ }
+}
diff --git a/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/dto/AdyenSubscriptionEnrollmentOfferWsDTO.java b/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/dto/AdyenSubscriptionEnrollmentOfferWsDTO.java
new file mode 100644
index 000000000..1dec635c4
--- /dev/null
+++ b/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/dto/AdyenSubscriptionEnrollmentOfferWsDTO.java
@@ -0,0 +1,67 @@
+/*
+ * ######
+ * ######
+ * ############ ####( ###### #####. ###### ############ ############
+ * ############# #####( ###### #####. ###### ############# #############
+ * ###### #####( ###### #####. ###### ##### ###### ##### ######
+ * ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
+ * ###### ###### #####( ###### #####. ###### ##### ##### ######
+ * ############# ############# ############# ############# ##### ######
+ * ############ ############ ############# ############ ##### ######
+ * ######
+ * #############
+ * ############
+ *
+ * Adyen Hybris Extension
+ *
+ * Copyright (c) 2026 Adyen B.V.
+ * This file is open source and available under the MIT license.
+ * See the LICENSE file for more info.
+ */
+package com.adyen.commerce.connector.occ.dto;
+
+import java.io.Serializable;
+
+/**
+ * The platform-hosted payment method page for one billing account. Carries no address: it is requested separately because it is a credential.
+ */
+public class AdyenSubscriptionEnrollmentOfferWsDTO implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private String subscriptionCode;
+
+ private String accountName;
+
+ private String notice;
+
+ public String getSubscriptionCode()
+ {
+ return subscriptionCode;
+ }
+
+ public void setSubscriptionCode(final String subscriptionCode)
+ {
+ this.subscriptionCode = subscriptionCode;
+ }
+
+ public String getAccountName()
+ {
+ return accountName;
+ }
+
+ public void setAccountName(final String accountName)
+ {
+ this.accountName = accountName;
+ }
+
+ public String getNotice()
+ {
+ return notice;
+ }
+
+ public void setNotice(final String notice)
+ {
+ this.notice = notice;
+ }
+}
diff --git a/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/dto/AdyenSubscriptionEnrollmentUrlWsDTO.java b/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/dto/AdyenSubscriptionEnrollmentUrlWsDTO.java
new file mode 100644
index 000000000..edf33090f
--- /dev/null
+++ b/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/dto/AdyenSubscriptionEnrollmentUrlWsDTO.java
@@ -0,0 +1,43 @@
+/*
+ * ######
+ * ######
+ * ############ ####( ###### #####. ###### ############ ############
+ * ############# #####( ###### #####. ###### ############# #############
+ * ###### #####( ###### #####. ###### ##### ###### ##### ######
+ * ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
+ * ###### ###### #####( ###### #####. ###### ##### ##### ######
+ * ############# ############# ############# ############# ##### ######
+ * ############ ############ ############# ############ ##### ######
+ * ######
+ * #############
+ * ############
+ *
+ * Adyen Hybris Extension
+ *
+ * Copyright (c) 2026 Adyen B.V.
+ * This file is open source and available under the MIT license.
+ * See the LICENSE file for more info.
+ */
+package com.adyen.commerce.connector.occ.dto;
+
+import java.io.Serializable;
+
+/**
+ * The address of the platform's payment method page. A credential on some platforms: never log it.
+ */
+public class AdyenSubscriptionEnrollmentUrlWsDTO implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private String url;
+
+ public String getUrl()
+ {
+ return url;
+ }
+
+ public void setUrl(final String url)
+ {
+ this.url = url;
+ }
+}
diff --git a/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/dto/AdyenSubscriptionEntryWsDTO.java b/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/dto/AdyenSubscriptionEntryWsDTO.java
new file mode 100644
index 000000000..41757e349
--- /dev/null
+++ b/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/dto/AdyenSubscriptionEntryWsDTO.java
@@ -0,0 +1,237 @@
+/*
+ * ######
+ * ######
+ * ############ ####( ###### #####. ###### ############ ############
+ * ############# #####( ###### #####. ###### ############# #############
+ * ###### #####( ###### #####. ###### ##### ###### ##### ######
+ * ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
+ * ###### ###### #####( ###### #####. ###### ##### ##### ######
+ * ############# ############# ############# ############# ##### ######
+ * ############ ############ ############# ############ ##### ######
+ * ######
+ * #############
+ * ############
+ *
+ * Adyen Hybris Extension
+ *
+ * Copyright (c) 2026 Adyen B.V.
+ * This file is open source and available under the MIT license.
+ * See the LICENSE file for more info.
+ */
+package com.adyen.commerce.connector.occ.dto;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * One subscription row. No plan code, amounts or platform identifiers are exposed. {@code state} is the enum name, {@code tone} is normal, attention or quiet, and the dates are ISO-8601.
+ */
+public class AdyenSubscriptionEntryWsDTO implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private String code;
+
+ private String productName;
+
+ private String state;
+
+ private String tone;
+
+ private String effectiveDate;
+
+ private Integer quantity;
+
+ private String orderCode;
+
+ private String orderDate;
+
+ private String paymentMethodSummary;
+
+ private boolean manageable;
+
+ private boolean cancellable;
+
+ private boolean paymentMethodChangeable;
+
+ private boolean paymentMethodControl;
+
+ private boolean paymentMethodShareable;
+
+ private boolean paymentMethodChangeCovered;
+
+ private List paymentMethodOptions = new ArrayList<>();
+
+ private List adyenVaultOptions = new ArrayList<>();
+
+ public String getCode()
+ {
+ return code;
+ }
+
+ public void setCode(final String code)
+ {
+ this.code = code;
+ }
+
+ public String getProductName()
+ {
+ return productName;
+ }
+
+ public void setProductName(final String productName)
+ {
+ this.productName = productName;
+ }
+
+ public String getState()
+ {
+ return state;
+ }
+
+ public void setState(final String state)
+ {
+ this.state = state;
+ }
+
+ public String getTone()
+ {
+ return tone;
+ }
+
+ public void setTone(final String tone)
+ {
+ this.tone = tone;
+ }
+
+ public String getEffectiveDate()
+ {
+ return effectiveDate;
+ }
+
+ public void setEffectiveDate(final String effectiveDate)
+ {
+ this.effectiveDate = effectiveDate;
+ }
+
+ public Integer getQuantity()
+ {
+ return quantity;
+ }
+
+ public void setQuantity(final Integer quantity)
+ {
+ this.quantity = quantity;
+ }
+
+ public String getOrderCode()
+ {
+ return orderCode;
+ }
+
+ public void setOrderCode(final String orderCode)
+ {
+ this.orderCode = orderCode;
+ }
+
+ public String getOrderDate()
+ {
+ return orderDate;
+ }
+
+ public void setOrderDate(final String orderDate)
+ {
+ this.orderDate = orderDate;
+ }
+
+ public String getPaymentMethodSummary()
+ {
+ return paymentMethodSummary;
+ }
+
+ public void setPaymentMethodSummary(final String paymentMethodSummary)
+ {
+ this.paymentMethodSummary = paymentMethodSummary;
+ }
+
+ public boolean isManageable()
+ {
+ return manageable;
+ }
+
+ public void setManageable(final boolean manageable)
+ {
+ this.manageable = manageable;
+ }
+
+ public boolean isCancellable()
+ {
+ return cancellable;
+ }
+
+ public void setCancellable(final boolean cancellable)
+ {
+ this.cancellable = cancellable;
+ }
+
+ public boolean isPaymentMethodChangeable()
+ {
+ return paymentMethodChangeable;
+ }
+
+ public void setPaymentMethodChangeable(final boolean paymentMethodChangeable)
+ {
+ this.paymentMethodChangeable = paymentMethodChangeable;
+ }
+
+ public boolean isPaymentMethodControl()
+ {
+ return paymentMethodControl;
+ }
+
+ public void setPaymentMethodControl(final boolean paymentMethodControl)
+ {
+ this.paymentMethodControl = paymentMethodControl;
+ }
+
+ public boolean isPaymentMethodShareable()
+ {
+ return paymentMethodShareable;
+ }
+
+ public void setPaymentMethodShareable(final boolean paymentMethodShareable)
+ {
+ this.paymentMethodShareable = paymentMethodShareable;
+ }
+
+ public boolean isPaymentMethodChangeCovered()
+ {
+ return paymentMethodChangeCovered;
+ }
+
+ public void setPaymentMethodChangeCovered(final boolean paymentMethodChangeCovered)
+ {
+ this.paymentMethodChangeCovered = paymentMethodChangeCovered;
+ }
+
+ public List getPaymentMethodOptions()
+ {
+ return paymentMethodOptions;
+ }
+
+ public void setPaymentMethodOptions(final List paymentMethodOptions)
+ {
+ this.paymentMethodOptions = paymentMethodOptions == null ? new ArrayList<>() : paymentMethodOptions;
+ }
+
+ public List getAdyenVaultOptions()
+ {
+ return adyenVaultOptions;
+ }
+
+ public void setAdyenVaultOptions(final List adyenVaultOptions)
+ {
+ this.adyenVaultOptions = adyenVaultOptions == null ? new ArrayList<>() : adyenVaultOptions;
+ }
+}
diff --git a/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/dto/AdyenSubscriptionOverviewWsDTO.java b/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/dto/AdyenSubscriptionOverviewWsDTO.java
new file mode 100644
index 000000000..448e2a345
--- /dev/null
+++ b/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/dto/AdyenSubscriptionOverviewWsDTO.java
@@ -0,0 +1,45 @@
+/*
+ * ######
+ * ######
+ * ############ ####( ###### #####. ###### ############ ############
+ * ############# #####( ###### #####. ###### ############# #############
+ * ###### #####( ###### #####. ###### ##### ###### ##### ######
+ * ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
+ * ###### ###### #####( ###### #####. ###### ##### ##### ######
+ * ############# ############# ############# ############# ##### ######
+ * ############ ############ ############# ############ ##### ######
+ * ######
+ * #############
+ * ############
+ *
+ * Adyen Hybris Extension
+ *
+ * Copyright (c) 2026 Adyen B.V.
+ * This file is open source and available under the MIT license.
+ * See the LICENSE file for more info.
+ */
+package com.adyen.commerce.connector.occ.dto;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * The shopper's subscriptions, one section per billing platform.
+ */
+public class AdyenSubscriptionOverviewWsDTO implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private List sections = new ArrayList<>();
+
+ public List getSections()
+ {
+ return sections;
+ }
+
+ public void setSections(final List sections)
+ {
+ this.sections = sections == null ? new ArrayList<>() : sections;
+ }
+}
diff --git a/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/dto/AdyenSubscriptionPaymentMethodChangeRequestWsDTO.java b/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/dto/AdyenSubscriptionPaymentMethodChangeRequestWsDTO.java
new file mode 100644
index 000000000..8afcefb94
--- /dev/null
+++ b/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/dto/AdyenSubscriptionPaymentMethodChangeRequestWsDTO.java
@@ -0,0 +1,67 @@
+/*
+ * ######
+ * ######
+ * ############ ####( ###### #####. ###### ############ ############
+ * ############# #####( ###### #####. ###### ############# #############
+ * ###### #####( ###### #####. ###### ##### ###### ##### ######
+ * ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
+ * ###### ###### #####( ###### #####. ###### ##### ##### ######
+ * ############# ############# ############# ############# ##### ######
+ * ############ ############ ############# ############ ##### ######
+ * ######
+ * #############
+ * ############
+ *
+ * Adyen Hybris Extension
+ *
+ * Copyright (c) 2026 Adyen B.V.
+ * This file is open source and available under the MIT license.
+ * See the LICENSE file for more info.
+ */
+package com.adyen.commerce.connector.occ.dto;
+
+import java.io.Serializable;
+
+/**
+ * Body of the payment method change. A plain POJO with setters, because OCC binds bodies with MOXy.
+ */
+public class AdyenSubscriptionPaymentMethodChangeRequestWsDTO implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private String platform;
+
+ private String storedPaymentMethodId;
+
+ private boolean applyToAll;
+
+ public String getPlatform()
+ {
+ return platform;
+ }
+
+ public void setPlatform(final String platform)
+ {
+ this.platform = platform;
+ }
+
+ public String getStoredPaymentMethodId()
+ {
+ return storedPaymentMethodId;
+ }
+
+ public void setStoredPaymentMethodId(final String storedPaymentMethodId)
+ {
+ this.storedPaymentMethodId = storedPaymentMethodId;
+ }
+
+ public boolean isApplyToAll()
+ {
+ return applyToAll;
+ }
+
+ public void setApplyToAll(final boolean applyToAll)
+ {
+ this.applyToAll = applyToAll;
+ }
+}
diff --git a/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/dto/AdyenSubscriptionPaymentMethodChangeResultWsDTO.java b/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/dto/AdyenSubscriptionPaymentMethodChangeResultWsDTO.java
new file mode 100644
index 000000000..5d3550139
--- /dev/null
+++ b/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/dto/AdyenSubscriptionPaymentMethodChangeResultWsDTO.java
@@ -0,0 +1,79 @@
+/*
+ * ######
+ * ######
+ * ############ ####( ###### #####. ###### ############ ############
+ * ############# #####( ###### #####. ###### ############# #############
+ * ###### #####( ###### #####. ###### ##### ###### ##### ######
+ * ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
+ * ###### ###### #####( ###### #####. ###### ##### ##### ######
+ * ############# ############# ############# ############# ##### ######
+ * ############ ############ ############# ############ ##### ######
+ * ######
+ * #############
+ * ############
+ *
+ * Adyen Hybris Extension
+ *
+ * Copyright (c) 2026 Adyen B.V.
+ * This file is open source and available under the MIT license.
+ * See the LICENSE file for more info.
+ */
+package com.adyen.commerce.connector.occ.dto;
+
+import java.io.Serializable;
+
+/**
+ * What a payment method change did. {@code result} is the PaymentMethodChangeResult name.
+ */
+public class AdyenSubscriptionPaymentMethodChangeResultWsDTO implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private String result;
+
+ private int moved;
+
+ private int failed;
+
+ private boolean partial;
+
+ public String getResult()
+ {
+ return result;
+ }
+
+ public void setResult(final String result)
+ {
+ this.result = result;
+ }
+
+ public int getMoved()
+ {
+ return moved;
+ }
+
+ public void setMoved(final int moved)
+ {
+ this.moved = moved;
+ }
+
+ public int getFailed()
+ {
+ return failed;
+ }
+
+ public void setFailed(final int failed)
+ {
+ this.failed = failed;
+ }
+
+ public boolean isPartial()
+ {
+ return partial;
+ }
+
+ public void setPartial(final boolean partial)
+ {
+ this.partial = partial;
+ }
+}
diff --git a/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/dto/AdyenSubscriptionPaymentMethodOptionWsDTO.java b/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/dto/AdyenSubscriptionPaymentMethodOptionWsDTO.java
new file mode 100644
index 000000000..71296cfe7
--- /dev/null
+++ b/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/dto/AdyenSubscriptionPaymentMethodOptionWsDTO.java
@@ -0,0 +1,67 @@
+/*
+ * ######
+ * ######
+ * ############ ####( ###### #####. ###### ############ ############
+ * ############# #####( ###### #####. ###### ############# #############
+ * ###### #####( ###### #####. ###### ##### ###### ##### ######
+ * ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
+ * ###### ###### #####( ###### #####. ###### ##### ##### ######
+ * ############# ############# ############# ############# ##### ######
+ * ############ ############ ############# ############ ##### ######
+ * ######
+ * #############
+ * ############
+ *
+ * Adyen Hybris Extension
+ *
+ * Copyright (c) 2026 Adyen B.V.
+ * This file is open source and available under the MIT license.
+ * See the LICENSE file for more info.
+ */
+package com.adyen.commerce.connector.occ.dto;
+
+import java.io.Serializable;
+
+/**
+ * A payment method the shopper can choose.
+ */
+public class AdyenSubscriptionPaymentMethodOptionWsDTO implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private String id;
+
+ private String displayLabel;
+
+ private boolean current;
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public void setId(final String id)
+ {
+ this.id = id;
+ }
+
+ public String getDisplayLabel()
+ {
+ return displayLabel;
+ }
+
+ public void setDisplayLabel(final String displayLabel)
+ {
+ this.displayLabel = displayLabel;
+ }
+
+ public boolean isCurrent()
+ {
+ return current;
+ }
+
+ public void setCurrent(final boolean current)
+ {
+ this.current = current;
+ }
+}
diff --git a/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/dto/AdyenSubscriptionSectionWsDTO.java b/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/dto/AdyenSubscriptionSectionWsDTO.java
new file mode 100644
index 000000000..ad70ae5ff
--- /dev/null
+++ b/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/dto/AdyenSubscriptionSectionWsDTO.java
@@ -0,0 +1,141 @@
+/*
+ * ######
+ * ######
+ * ############ ####( ###### #####. ###### ############ ############
+ * ############# #####( ###### #####. ###### ############# #############
+ * ###### #####( ###### #####. ###### ##### ###### ##### ######
+ * ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
+ * ###### ###### #####( ###### #####. ###### ##### ##### ######
+ * ############# ############# ############# ############# ##### ######
+ * ############ ############ ############# ############ ##### ######
+ * ######
+ * #############
+ * ############
+ *
+ * Adyen Hybris Extension
+ *
+ * Copyright (c) 2026 Adyen B.V.
+ * This file is open source and available under the MIT license.
+ * See the LICENSE file for more info.
+ */
+package com.adyen.commerce.connector.occ.dto;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * What the page shows for one billing platform.
+ */
+public class AdyenSubscriptionSectionWsDTO implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ private String platformCode;
+
+ private String platformName;
+
+ private List subscriptions = new ArrayList<>();
+
+ private List ordersAwaitingSetup = new ArrayList<>();
+
+ private List paymentMethodChangeOffers = new ArrayList<>();
+
+ private List paymentMethodEnrollmentOffers = new ArrayList<>();
+
+ private boolean paymentMethodChangeSupported;
+
+ private boolean paymentMethodChangeOffered;
+
+ private boolean rowPaymentMethodControlOffered;
+
+ public String getPlatformCode()
+ {
+ return platformCode;
+ }
+
+ public void setPlatformCode(final String platformCode)
+ {
+ this.platformCode = platformCode;
+ }
+
+ public String getPlatformName()
+ {
+ return platformName;
+ }
+
+ public void setPlatformName(final String platformName)
+ {
+ this.platformName = platformName;
+ }
+
+ public List getSubscriptions()
+ {
+ return subscriptions;
+ }
+
+ public void setSubscriptions(final List subscriptions)
+ {
+ this.subscriptions = subscriptions == null ? new ArrayList<>() : subscriptions;
+ }
+
+ public List getOrdersAwaitingSetup()
+ {
+ return ordersAwaitingSetup;
+ }
+
+ public void setOrdersAwaitingSetup(final List ordersAwaitingSetup)
+ {
+ this.ordersAwaitingSetup = ordersAwaitingSetup == null ? new ArrayList<>() : ordersAwaitingSetup;
+ }
+
+ public List getPaymentMethodChangeOffers()
+ {
+ return paymentMethodChangeOffers;
+ }
+
+ public void setPaymentMethodChangeOffers(final List paymentMethodChangeOffers)
+ {
+ this.paymentMethodChangeOffers = paymentMethodChangeOffers == null ? new ArrayList<>() : paymentMethodChangeOffers;
+ }
+
+ public List getPaymentMethodEnrollmentOffers()
+ {
+ return paymentMethodEnrollmentOffers;
+ }
+
+ public void setPaymentMethodEnrollmentOffers(final List paymentMethodEnrollmentOffers)
+ {
+ this.paymentMethodEnrollmentOffers = paymentMethodEnrollmentOffers == null ? new ArrayList<>() : paymentMethodEnrollmentOffers;
+ }
+
+ public boolean isPaymentMethodChangeSupported()
+ {
+ return paymentMethodChangeSupported;
+ }
+
+ public void setPaymentMethodChangeSupported(final boolean paymentMethodChangeSupported)
+ {
+ this.paymentMethodChangeSupported = paymentMethodChangeSupported;
+ }
+
+ public boolean isPaymentMethodChangeOffered()
+ {
+ return paymentMethodChangeOffered;
+ }
+
+ public void setPaymentMethodChangeOffered(final boolean paymentMethodChangeOffered)
+ {
+ this.paymentMethodChangeOffered = paymentMethodChangeOffered;
+ }
+
+ public boolean isRowPaymentMethodControlOffered()
+ {
+ return rowPaymentMethodControlOffered;
+ }
+
+ public void setRowPaymentMethodControlOffered(final boolean rowPaymentMethodControlOffered)
+ {
+ this.rowPaymentMethodControlOffered = rowPaymentMethodControlOffered;
+ }
+}
diff --git a/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/exceptions/SubscriptionActionRefusedException.java b/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/exceptions/SubscriptionActionRefusedException.java
new file mode 100644
index 000000000..8b625241d
--- /dev/null
+++ b/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/exceptions/SubscriptionActionRefusedException.java
@@ -0,0 +1,53 @@
+/*
+ * ######
+ * ######
+ * ############ ####( ###### #####. ###### ############ ############
+ * ############# #####( ###### #####. ###### ############# #############
+ * ###### #####( ###### #####. ###### ##### ###### ##### ######
+ * ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
+ * ###### ###### #####( ###### #####. ###### ##### ##### ######
+ * ############# ############# ############# ############# ##### ######
+ * ############ ############ ############# ############ ##### ######
+ * ######
+ * #############
+ * ############
+ *
+ * Adyen Hybris Extension
+ *
+ * Copyright (c) 2026 Adyen B.V.
+ * This file is open source and available under the MIT license.
+ * See the LICENSE file for more info.
+ */
+package com.adyen.commerce.connector.occ.exceptions;
+
+import de.hybris.platform.webservicescommons.errors.exceptions.WebserviceException;
+
+/**
+ * The one answer to a subscription action that did not happen, whatever the reason: a code that is not the
+ * shopper's, a state that does not allow it, a missing platform, a platform that said no. Telling them apart
+ * on the wire would tell a caller probing for codes which ones exist, so the message is fixed, carries no
+ * reason or subject, and never quotes anything a billing platform said. Translated by the OCC error
+ * resolver into a 400 {@code ErrorListWsDTO} of type {@code SubscriptionActionRefusedError}.
+ */
+public class SubscriptionActionRefusedException extends WebserviceException
+{
+ public static final String TYPE = "SubscriptionActionRefusedError";
+ public static final String MESSAGE = "The subscription action was refused";
+
+ public SubscriptionActionRefusedException()
+ {
+ super(MESSAGE);
+ }
+
+ @Override
+ public String getType()
+ {
+ return TYPE;
+ }
+
+ @Override
+ public String getSubjectType()
+ {
+ return null;
+ }
+}
diff --git a/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/mapper/AdyenMySubscriptionsWsMapper.java b/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/mapper/AdyenMySubscriptionsWsMapper.java
new file mode 100644
index 000000000..93747fc6c
--- /dev/null
+++ b/adyensubscriptionconnector/src/com/adyen/commerce/connector/occ/mapper/AdyenMySubscriptionsWsMapper.java
@@ -0,0 +1,163 @@
+/*
+ * ######
+ * ######
+ * ############ ####( ###### #####. ###### ############ ############
+ * ############# #####( ###### #####. ###### ############# #############
+ * ###### #####( ###### #####. ###### ##### ###### ##### ######
+ * ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
+ * ###### ###### #####( ###### #####. ###### ##### ##### ######
+ * ############# ############# ############# ############# ##### ######
+ * ############ ############ ############# ############ ##### ######
+ * ######
+ * #############
+ * ############
+ *
+ * Adyen Hybris Extension
+ *
+ * Copyright (c) 2026 Adyen B.V.
+ * This file is open source and available under the MIT license.
+ * See the LICENSE file for more info.
+ */
+package com.adyen.commerce.connector.occ.mapper;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import com.adyen.commerce.connector.facades.data.PaymentMethodChangeOfferData;
+import com.adyen.commerce.connector.facades.data.PaymentMethodChangeReport;
+import com.adyen.commerce.connector.facades.data.PaymentMethodEnrollmentOfferData;
+import com.adyen.commerce.connector.facades.data.PaymentMethodOptionData;
+import com.adyen.commerce.connector.facades.data.SubscriptionEntryData;
+import com.adyen.commerce.connector.facades.data.SubscriptionOverviewData;
+import com.adyen.commerce.connector.facades.data.SubscriptionPlatformSectionData;
+import com.adyen.commerce.connector.occ.dto.AdyenSubscriptionChangeOfferWsDTO;
+import com.adyen.commerce.connector.occ.dto.AdyenSubscriptionEnrollmentOfferWsDTO;
+import com.adyen.commerce.connector.occ.dto.AdyenSubscriptionEntryWsDTO;
+import com.adyen.commerce.connector.occ.dto.AdyenSubscriptionOverviewWsDTO;
+import com.adyen.commerce.connector.occ.dto.AdyenSubscriptionPaymentMethodChangeResultWsDTO;
+import com.adyen.commerce.connector.occ.dto.AdyenSubscriptionPaymentMethodOptionWsDTO;
+import com.adyen.commerce.connector.occ.dto.AdyenSubscriptionSectionWsDTO;
+
+/**
+ * Maps what the {@code MySubscriptionsFacade} returns onto the OCC DTOs, by hand rather than through an
+ * Orika {@code DataMapper}: the derived flags ({@code cancellable}, {@code tone},
+ * {@code paymentMethodChangeOffered}) are getters with no backing field, which Orika would silently skip
+ * unless every WsDTO declared a matching setter. Writing them out keeps the rule in one visible place.
+ *
+ *
Every step is a {@code protected} instance method so a merchant can override one of them.
+ */
+public class AdyenMySubscriptionsWsMapper
+{
+ public AdyenSubscriptionOverviewWsDTO toOverview(final SubscriptionOverviewData source)
+ {
+ final AdyenSubscriptionOverviewWsDTO target = new AdyenSubscriptionOverviewWsDTO();
+ if (source != null)
+ {
+ target.setSections(mapAll(source.getSections(), this::toSection));
+ }
+ return target;
+ }
+
+ protected AdyenSubscriptionSectionWsDTO toSection(final SubscriptionPlatformSectionData source)
+ {
+ final AdyenSubscriptionSectionWsDTO target = new AdyenSubscriptionSectionWsDTO();
+ target.setPlatformCode(source.getPlatformCode());
+ target.setPlatformName(source.getPlatformName());
+ target.setSubscriptions(mapAll(source.getSubscriptions(), this::toEntry));
+ target.setOrdersAwaitingSetup(new ArrayList<>(source.getOrdersAwaitingSetup()));
+ target.setPaymentMethodChangeOffers(mapAll(source.getPaymentMethodChangeOffers(), this::toChangeOffer));
+ target.setPaymentMethodEnrollmentOffers(
+ mapAll(source.getPaymentMethodEnrollmentOffers(), this::toEnrollmentOffer));
+ target.setPaymentMethodChangeSupported(source.isPaymentMethodChangeSupported());
+ target.setPaymentMethodChangeOffered(source.isPaymentMethodChangeOffered());
+ target.setRowPaymentMethodControlOffered(source.isRowPaymentMethodControlOffered());
+ return target;
+ }
+
+ protected AdyenSubscriptionEntryWsDTO toEntry(final SubscriptionEntryData source)
+ {
+ final AdyenSubscriptionEntryWsDTO target = new AdyenSubscriptionEntryWsDTO();
+ target.setCode(source.getCode());
+ target.setProductName(source.getProductName());
+ if (source.getState() != null)
+ {
+ target.setState(source.getState().name());
+ target.setTone(source.getState().getTone());
+ }
+ target.setEffectiveDate(toIso(source.getEffectiveDate()));
+ target.setQuantity(source.getQuantity());
+ target.setOrderCode(source.getOrderCode());
+ target.setOrderDate(toIso(source.getOrderDate()));
+ target.setPaymentMethodSummary(source.getPaymentMethodSummary());
+ target.setManageable(source.isManageable());
+ target.setCancellable(source.isCancellable());
+ target.setPaymentMethodChangeable(source.isPaymentMethodChangeable());
+ target.setPaymentMethodControl(source.isPaymentMethodControl());
+ target.setPaymentMethodShareable(source.isPaymentMethodShareable());
+ target.setPaymentMethodChangeCovered(source.isPaymentMethodChangeCovered());
+ target.setPaymentMethodOptions(mapAll(source.getPaymentMethodOptions(), this::toOption));
+ target.setAdyenVaultOptions(mapAll(source.getAdyenVaultOptions(), this::toOption));
+ return target;
+ }
+
+ protected AdyenSubscriptionChangeOfferWsDTO toChangeOffer(final PaymentMethodChangeOfferData source)
+ {
+ final AdyenSubscriptionChangeOfferWsDTO target = new AdyenSubscriptionChangeOfferWsDTO();
+ target.setSubscriptionCode(source.getSubscriptionCode());
+ target.setAccountName(source.getAccountName());
+ target.setPaymentMethodOptions(mapAll(source.getPaymentMethodOptions(), this::toOption));
+ target.setAdyenVaultOptions(mapAll(source.getAdyenVaultOptions(), this::toOption));
+ return target;
+ }
+
+ protected AdyenSubscriptionEnrollmentOfferWsDTO toEnrollmentOffer(final PaymentMethodEnrollmentOfferData source)
+ {
+ final AdyenSubscriptionEnrollmentOfferWsDTO target = new AdyenSubscriptionEnrollmentOfferWsDTO();
+ target.setSubscriptionCode(source.getSubscriptionCode());
+ target.setAccountName(source.getAccountName());
+ target.setNotice(source.getNotice() == null ? null : source.getNotice().name());
+ return target;
+ }
+
+ protected AdyenSubscriptionPaymentMethodOptionWsDTO toOption(final PaymentMethodOptionData source)
+ {
+ final AdyenSubscriptionPaymentMethodOptionWsDTO target = new AdyenSubscriptionPaymentMethodOptionWsDTO();
+ target.setId(source.getId());
+ target.setDisplayLabel(source.getDisplayLabel());
+ target.setCurrent(source.isCurrent());
+ return target;
+ }
+
+ public AdyenSubscriptionPaymentMethodChangeResultWsDTO toChangeResult(final PaymentMethodChangeReport source)
+ {
+ final AdyenSubscriptionPaymentMethodChangeResultWsDTO target = new AdyenSubscriptionPaymentMethodChangeResultWsDTO();
+ target.setResult(source.result() == null ? null : source.result().name());
+ target.setMoved(source.moved());
+ target.setFailed(source.failed());
+ target.setPartial(source.isPartial());
+ return target;
+ }
+
+ /** ISO-8601 in UTC with a trailing {@code Z}, or {@code null} for no date. */
+ protected String toIso(final Date date)
+ {
+ return date == null ? null : date.toInstant().toString();
+ }
+
+ protected List mapAll(final List sources, final java.util.function.Function mapping)
+ {
+ final List targets = new ArrayList<>();
+ if (sources != null)
+ {
+ for (final S source : sources)
+ {
+ if (source != null)
+ {
+ targets.add(mapping.apply(source));
+ }
+ }
+ }
+ return targets;
+ }
+}
diff --git a/adyensubscriptionb2caddon/src/com/adyen/commerce/subscription/restrictions/SubscriptionPlatformRestrictionDescriptionHandler.java b/adyensubscriptionconnector/src/com/adyen/commerce/connector/restrictions/SubscriptionPlatformRestrictionDescriptionHandler.java
similarity index 92%
rename from adyensubscriptionb2caddon/src/com/adyen/commerce/subscription/restrictions/SubscriptionPlatformRestrictionDescriptionHandler.java
rename to adyensubscriptionconnector/src/com/adyen/commerce/connector/restrictions/SubscriptionPlatformRestrictionDescriptionHandler.java
index 26da621d4..7834a18e2 100644
--- a/adyensubscriptionb2caddon/src/com/adyen/commerce/subscription/restrictions/SubscriptionPlatformRestrictionDescriptionHandler.java
+++ b/adyensubscriptionconnector/src/com/adyen/commerce/connector/restrictions/SubscriptionPlatformRestrictionDescriptionHandler.java
@@ -18,9 +18,9 @@
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
-package com.adyen.commerce.subscription.restrictions;
+package com.adyen.commerce.connector.restrictions;
-import com.adyen.commerce.subscription.model.AdyenSubscriptionPlatformRestrictionModel;
+import com.adyen.commerce.connector.model.AdyenSubscriptionPlatformRestrictionModel;
import de.hybris.platform.servicelayer.model.attribute.DynamicAttributeHandler;
diff --git a/adyensubscriptionb2caddon/src/com/adyen/commerce/subscription/restrictions/SubscriptionPlatformRestrictionEvaluator.java b/adyensubscriptionconnector/src/com/adyen/commerce/connector/restrictions/SubscriptionPlatformRestrictionEvaluator.java
similarity index 93%
rename from adyensubscriptionb2caddon/src/com/adyen/commerce/subscription/restrictions/SubscriptionPlatformRestrictionEvaluator.java
rename to adyensubscriptionconnector/src/com/adyen/commerce/connector/restrictions/SubscriptionPlatformRestrictionEvaluator.java
index fce067a22..1574802e5 100644
--- a/adyensubscriptionb2caddon/src/com/adyen/commerce/subscription/restrictions/SubscriptionPlatformRestrictionEvaluator.java
+++ b/adyensubscriptionconnector/src/com/adyen/commerce/connector/restrictions/SubscriptionPlatformRestrictionEvaluator.java
@@ -18,10 +18,10 @@
* This file is open source and available under the MIT license.
* See the LICENSE file for more info.
*/
-package com.adyen.commerce.subscription.restrictions;
+package com.adyen.commerce.connector.restrictions;
import com.adyen.commerce.connector.facades.MySubscriptionsFacade;
-import com.adyen.commerce.subscription.model.AdyenSubscriptionPlatformRestrictionModel;
+import com.adyen.commerce.connector.model.AdyenSubscriptionPlatformRestrictionModel;
import de.hybris.platform.cms2.servicelayer.data.RestrictionData;
import de.hybris.platform.cms2.servicelayer.services.evaluator.CMSRestrictionEvaluator;
diff --git a/adyensubscriptionconnector/testsrc/com/adyen/commerce/connector/occ/controllers/AdyenMySubscriptionsControllerTest.java b/adyensubscriptionconnector/testsrc/com/adyen/commerce/connector/occ/controllers/AdyenMySubscriptionsControllerTest.java
new file mode 100644
index 000000000..0ff9b414e
--- /dev/null
+++ b/adyensubscriptionconnector/testsrc/com/adyen/commerce/connector/occ/controllers/AdyenMySubscriptionsControllerTest.java
@@ -0,0 +1,300 @@
+/*
+ * ######
+ * ######
+ * ############ ####( ###### #####. ###### ############ ############
+ * ############# #####( ###### #####. ###### ############# #############
+ * ###### #####( ###### #####. ###### ##### ###### ##### ######
+ * ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
+ * ###### ###### #####( ###### #####. ###### ##### ##### ######
+ * ############# ############# ############# ############# ##### ######
+ * ############ ############ ############# ############ ##### ######
+ * ######
+ * #############
+ * ############
+ *
+ * Adyen Hybris Extension
+ *
+ * Copyright (c) 2026 Adyen B.V.
+ * This file is open source and available under the MIT license.
+ * See the LICENSE file for more info.
+ */
+package com.adyen.commerce.connector.occ.controllers;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.isNull;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.List;
+import java.util.function.Supplier;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.security.access.annotation.Secured;
+
+import com.adyen.commerce.connector.facades.MySubscriptionsFacade;
+import com.adyen.commerce.connector.facades.data.PaymentMethodChangeReport;
+import com.adyen.commerce.connector.facades.data.PaymentMethodChangeResult;
+import com.adyen.commerce.connector.facades.data.SubscriptionOverviewData;
+import com.adyen.commerce.connector.occ.dto.AdyenSubscriptionCancelResultWsDTO;
+import com.adyen.commerce.connector.occ.dto.AdyenSubscriptionEnrollmentUrlWsDTO;
+import com.adyen.commerce.connector.occ.dto.AdyenSubscriptionOverviewWsDTO;
+import com.adyen.commerce.connector.occ.dto.AdyenSubscriptionPaymentMethodChangeRequestWsDTO;
+import com.adyen.commerce.connector.occ.dto.AdyenSubscriptionPaymentMethodChangeResultWsDTO;
+import com.adyen.commerce.connector.occ.exceptions.SubscriptionActionRefusedException;
+import com.adyen.commerce.connector.occ.mapper.AdyenMySubscriptionsWsMapper;
+
+import de.hybris.bootstrap.annotations.UnitTest;
+
+/**
+ * Unit test for {@link AdyenMySubscriptionsController}. It pins what the contract promises and the facade
+ * cannot: who may call which method, that every refusal is one indistinguishable error, that nothing a
+ * platform said reaches the body, and that a missing connector is a 404 on every route.
+ */
+@UnitTest
+public class AdyenMySubscriptionsControllerTest
+{
+ private static final String PLATFORM = "RECURLY";
+ private static final String CODE = "sub-1";
+ private static final String SECRET_URL = "https://example.invalid/hosted?token=SECRET";
+
+ @Mock
+ private MySubscriptionsFacade facade;
+
+ private AdyenMySubscriptionsController controller;
+
+ @Before
+ public void setUp()
+ {
+ MockitoAnnotations.openMocks(this);
+ controller = new AdyenMySubscriptionsController();
+ controller.setMySubscriptionsFacade(facade);
+ controller.setMapper(new AdyenMySubscriptionsWsMapper());
+ when(facade.hasAvailablePlatforms()).thenReturn(true);
+ }
+
+ // ---- roles -------------------------------------------------------------------------------------
+
+ @Test
+ public void getAllowsClientAndTrustedClient_mutationsDoNot() throws Exception
+ {
+ assertRoles("getSubscriptions", new String[] { "ROLE_CUSTOMERGROUP", "ROLE_CLIENT",
+ "ROLE_CUSTOMERMANAGERGROUP", "ROLE_TRUSTED_CLIENT" });
+ final String[] customerOnly = { "ROLE_CUSTOMERGROUP", "ROLE_CUSTOMERMANAGERGROUP" };
+ assertRoles("cancel", customerOnly, String.class, String.class);
+ assertRoles("changePaymentMethod", customerOnly, String.class,
+ AdyenSubscriptionPaymentMethodChangeRequestWsDTO.class);
+ assertRoles("enrollment", customerOnly, String.class, String.class);
+ }
+
+ private void assertRoles(final String name, final String[] expected, final Class>... params) throws Exception
+ {
+ final Method method = AdyenMySubscriptionsController.class.getMethod(name, params);
+ final Secured secured = method.getAnnotation(Secured.class);
+ assertNotNull(name + " must be @Secured", secured);
+ assertArrayEquals(name, expected, secured.value());
+ }
+
+ // ---- 404 ---------------------------------------------------------------------------------------
+
+ @Test
+ public void everyRouteAnswers404WhenNoPlatformIsLoaded()
+ {
+ when(facade.hasAvailablePlatforms()).thenReturn(false);
+ final AdyenSubscriptionPaymentMethodChangeRequestWsDTO body = changeRequest(false);
+
+ assertEquals(HttpStatus.NOT_FOUND, controller.getSubscriptions().getStatusCode());
+ assertEquals(HttpStatus.NOT_FOUND, controller.cancel(CODE, PLATFORM).getStatusCode());
+ assertEquals(HttpStatus.NOT_FOUND, controller.changePaymentMethod(CODE, body).getStatusCode());
+ assertEquals(HttpStatus.NOT_FOUND, controller.enrollment(CODE, PLATFORM).getStatusCode());
+
+ verify(facade, never()).getSubscriptionsForCurrentCustomer();
+ verify(facade, never()).cancelForCurrentCustomer(anyString(), anyString());
+ verify(facade, never()).paymentMethodEnrollmentUrlForCurrentCustomer(anyString(), anyString());
+ }
+
+ // ---- list --------------------------------------------------------------------------------------
+
+ @Test
+ public void getReturnsTheMappedOverview()
+ {
+ when(facade.getSubscriptionsForCurrentCustomer()).thenReturn(new SubscriptionOverviewData());
+
+ final ResponseEntity response = controller.getSubscriptions();
+
+ assertEquals(HttpStatus.OK, response.getStatusCode());
+ assertNotNull(response.getBody());
+ assertTrue(response.getBody().getSections().isEmpty());
+ }
+
+ // ---- one refusal -------------------------------------------------------------------------------
+
+ @Test
+ public void everyCancelRefusalIsTheSameError()
+ {
+ final Supplier