From d6a731a093884ca3e0deed5d6e82db02453d289c Mon Sep 17 00:00:00 2001 From: Mitchell Williams Date: Tue, 24 Feb 2026 10:18:49 -0700 Subject: [PATCH] fix: pass id with update notification preferences this id is needed for the subsequent request --- .../mdx/accessor/managed_card/ManagedCardBaseAccessor.java | 2 +- .../model/mdx/web/controller/ManagedCardsController.java | 4 ++-- .../mdx/web/controller/ManagedCardsControllerTest.groovy | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mdx-models/src/main/java/com/mx/path/model/mdx/accessor/managed_card/ManagedCardBaseAccessor.java b/mdx-models/src/main/java/com/mx/path/model/mdx/accessor/managed_card/ManagedCardBaseAccessor.java index 3fe7f41a..faec0d80 100644 --- a/mdx-models/src/main/java/com/mx/path/model/mdx/accessor/managed_card/ManagedCardBaseAccessor.java +++ b/mdx-models/src/main/java/com/mx/path/model/mdx/accessor/managed_card/ManagedCardBaseAccessor.java @@ -167,7 +167,7 @@ public AccessorResponse update(String id, ManagedCard card) { */ @GatewayAPI @API(description = "Update a managed card's notification preferences") - public AccessorResponse updateNotificationPreferences(NotificationPreferences notificationPreferences) { + public AccessorResponse updateNotificationPreferences(String id, NotificationPreferences notificationPreferences) { throw new AccessorMethodNotImplementedException(); } } diff --git a/mdx-web/src/main/java/com/mx/path/model/mdx/web/controller/ManagedCardsController.java b/mdx-web/src/main/java/com/mx/path/model/mdx/web/controller/ManagedCardsController.java index 6ae7194b..6b44511f 100644 --- a/mdx-web/src/main/java/com/mx/path/model/mdx/web/controller/ManagedCardsController.java +++ b/mdx-web/src/main/java/com/mx/path/model/mdx/web/controller/ManagedCardsController.java @@ -91,8 +91,8 @@ public final ResponseEntity getCvv(@PathVariable("id") String id) t } @RequestMapping(value = "/users/{userId}/managed_cards/{id}/notification_preferences", method = RequestMethod.PUT, consumes = MDX_MEDIA) - public final ResponseEntity updateNotificationPreferences(@RequestBody NotificationPreferences notificationPreferencesRequest) throws Exception { - AccessorResponse response = gateway().managedCards().updateNotificationPreferences(notificationPreferencesRequest); + public final ResponseEntity updateNotificationPreferences(@PathVariable("id") String id, @RequestBody NotificationPreferences notificationPreferencesRequest) throws Exception { + AccessorResponse response = gateway().managedCards().updateNotificationPreferences(id, notificationPreferencesRequest); return new ResponseEntity<>(response.getResult().wrapped(), createMultiMapForResponse(response.getHeaders()), HttpStatus.OK); } } diff --git a/mdx-web/src/test/groovy/com/mx/path/model/mdx/web/controller/ManagedCardsControllerTest.groovy b/mdx-web/src/test/groovy/com/mx/path/model/mdx/web/controller/ManagedCardsControllerTest.groovy index f1129b0c..8095a392 100644 --- a/mdx-web/src/test/groovy/com/mx/path/model/mdx/web/controller/ManagedCardsControllerTest.groovy +++ b/mdx-web/src/test/groovy/com/mx/path/model/mdx/web/controller/ManagedCardsControllerTest.groovy @@ -212,13 +212,13 @@ class ManagedCardsControllerTest extends Specification { NotificationPreferences notificationPreferences = new NotificationPreferences().tap { setAllowPushNotification(false) } - doReturn(new AccessorResponse().withResult(notificationPreferences)).when(managedCardGateway).updateNotificationPreferences(notificationPreferences) + doReturn(new AccessorResponse().withResult(notificationPreferences)).when(managedCardGateway).updateNotificationPreferences("CARD-123", notificationPreferences) when: - def response = subject.updateNotificationPreferences(notificationPreferences) + def response = subject.updateNotificationPreferences("CARD-123", notificationPreferences) then: - verify(managedCardGateway).updateNotificationPreferences(notificationPreferences) || true + verify(managedCardGateway).updateNotificationPreferences("CARD-123", notificationPreferences) || true response.body == notificationPreferences HttpStatus.OK == response.statusCode }