diff --git a/.vogue.yml b/.vogue.yml index 631af3ba..9e382642 100644 --- a/.vogue.yml +++ b/.vogue.yml @@ -3,7 +3,22 @@ defaultRules: {} packageRules: - package: "com.github.mxenabled.coppuccino:com.github.mxenabled.coppuccino.gradle.plugin" rules: {} - suppressUntil: "2026-02-09" + suppressUntil: "2026-02-28" - package: "com.github.mxenabled.vogue:com.github.mxenabled.vogue.gradle.plugin" rules: {} - suppressUntil: "2026-02-09" + suppressUntil: "2026-02-28" +- package: "com.mx.path-core:gateway" + rules: {} + suppressUntil: "2026-02-28" +- package: "com.mx.path-core:gateway-generator" + rules: {} + suppressUntil: "2026-02-28" +- package: "com.mx.path-core:http" + rules: {} + suppressUntil: "2026-02-28" +- package: "com.mx.path-core:platform" + rules: {} + suppressUntil: "2026-02-28" +- package: "com.mx.path-core:testing" + rules: {} + suppressUntil: "2026-02-28" 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 3891a608..3fe7f41a 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 @@ -9,6 +9,7 @@ import com.mx.path.gateway.accessor.AccessorResponse; import com.mx.path.model.mdx.model.MdxList; import com.mx.path.model.mdx.model.managed_cards.ManagedCard; +import com.mx.path.model.mdx.model.managed_cards.NotificationPreferences; /** * Accessor base for managed card operations @@ -158,4 +159,15 @@ public AccessorResponse setPin(String id, ManagedCard card) { public AccessorResponse update(String id, ManagedCard card) { throw new AccessorMethodNotImplementedException(); } + + /** + * Update a managed card's notification preferences + * + * @return + */ + @GatewayAPI + @API(description = "Update a managed card's notification preferences") + public AccessorResponse updateNotificationPreferences(NotificationPreferences notificationPreferences) { + throw new AccessorMethodNotImplementedException(); + } } diff --git a/mdx-models/src/main/java/com/mx/path/model/mdx/model/Resources.java b/mdx-models/src/main/java/com/mx/path/model/mdx/model/Resources.java index 0181a6bb..84c24572 100644 --- a/mdx-models/src/main/java/com/mx/path/model/mdx/model/Resources.java +++ b/mdx-models/src/main/java/com/mx/path/model/mdx/model/Resources.java @@ -44,6 +44,7 @@ import com.mx.path.model.mdx.model.location.Location; import com.mx.path.model.mdx.model.managed_cards.Destination; import com.mx.path.model.mdx.model.managed_cards.ManagedCard; +import com.mx.path.model.mdx.model.managed_cards.NotificationPreferences; import com.mx.path.model.mdx.model.managed_cards.TravelSchedule; import com.mx.path.model.mdx.model.ondemand.MdxListWrapper; import com.mx.path.model.mdx.model.ondemand.MdxOnDemandDeserializer; @@ -255,6 +256,7 @@ public static void registerResources(GsonBuilder builder) { builder.registerTypeAdapter(ManagedCard.class, new ModelWrappableSerializer("managed_card")); builder.registerTypeAdapter(new TypeToken>() { }.getType(), new ModelWrappableSerializer("managed_cards")); + builder.registerTypeAdapter(NotificationPreferences.class, new ModelWrappableSerializer("notification_preferences")); // RemoteDeposit builder.registerTypeAdapter(RemoteDeposit.class, new ModelWrappableSerializer("remote_deposit")); builder.registerTypeAdapter(new TypeToken>() { diff --git a/mdx-models/src/main/java/com/mx/path/model/mdx/model/managed_cards/NotificationPreferences.java b/mdx-models/src/main/java/com/mx/path/model/mdx/model/managed_cards/NotificationPreferences.java new file mode 100644 index 00000000..ff908771 --- /dev/null +++ b/mdx-models/src/main/java/com/mx/path/model/mdx/model/managed_cards/NotificationPreferences.java @@ -0,0 +1,13 @@ +package com.mx.path.model.mdx.model.managed_cards; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +import com.mx.path.model.mdx.model.MdxBase; + +@Data +@EqualsAndHashCode(callSuper = true) +public final class NotificationPreferences extends MdxBase { + + private Boolean allowPushNotification; +} 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 51bd61b0..6ae7194b 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 @@ -3,6 +3,7 @@ import com.mx.path.gateway.accessor.AccessorResponse; import com.mx.path.model.mdx.model.MdxList; import com.mx.path.model.mdx.model.managed_cards.ManagedCard; +import com.mx.path.model.mdx.model.managed_cards.NotificationPreferences; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -89,4 +90,9 @@ public final ResponseEntity getCvv(@PathVariable("id") String id) t return new ResponseEntity<>(response.getResult().wrapped(), createMultiMapForResponse(response.getHeaders()), HttpStatus.OK); } + @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); + 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 7702cd29..f1129b0c 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 @@ -10,6 +10,7 @@ import com.mx.path.gateway.api.managed_card.ManagedCardGateway import com.mx.path.model.mdx.model.MdxList import com.mx.path.model.mdx.model.challenges.Challenge import com.mx.path.model.mdx.model.managed_cards.ManagedCard +import com.mx.path.model.mdx.model.managed_cards.NotificationPreferences import org.springframework.http.HttpStatus @@ -205,4 +206,20 @@ class ManagedCardsControllerTest extends Specification { verify(managedCardGateway).getUnmaskedCardNumber(managedCard.id) || true response.body == managedCard } + + def "update notification preferences interacts with gateway"() { + given: + NotificationPreferences notificationPreferences = new NotificationPreferences().tap { + setAllowPushNotification(false) + } + doReturn(new AccessorResponse().withResult(notificationPreferences)).when(managedCardGateway).updateNotificationPreferences(notificationPreferences) + + when: + def response = subject.updateNotificationPreferences(notificationPreferences) + + then: + verify(managedCardGateway).updateNotificationPreferences(notificationPreferences) || true + response.body == notificationPreferences + HttpStatus.OK == response.statusCode + } }