Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions .vogue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -158,4 +159,15 @@ public AccessorResponse<ManagedCard> setPin(String id, ManagedCard card) {
public AccessorResponse<ManagedCard> 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<NotificationPreferences> updateNotificationPreferences(NotificationPreferences notificationPreferences) {
throw new AccessorMethodNotImplementedException();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -255,6 +256,7 @@ public static void registerResources(GsonBuilder builder) {
builder.registerTypeAdapter(ManagedCard.class, new ModelWrappableSerializer("managed_card"));
builder.registerTypeAdapter(new TypeToken<MdxList<ManagedCard>>() {
}.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<MdxList<RemoteDeposit>>() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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<NotificationPreferences> {

private Boolean allowPushNotification;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -89,4 +90,9 @@ public final ResponseEntity<ManagedCard> 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<NotificationPreferences> response = gateway().managedCards().updateNotificationPreferences(notificationPreferencesRequest);
return new ResponseEntity<>(response.getResult().wrapped(), createMultiMapForResponse(response.getHeaders()), HttpStatus.OK);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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<NotificationPreferences>().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
}
}