Skip to content

Commit d6a731a

Browse files
fix: pass id with update notification preferences
this id is needed for the subsequent request
1 parent fec2b00 commit d6a731a

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

mdx-models/src/main/java/com/mx/path/model/mdx/accessor/managed_card/ManagedCardBaseAccessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public AccessorResponse<ManagedCard> update(String id, ManagedCard card) {
167167
*/
168168
@GatewayAPI
169169
@API(description = "Update a managed card's notification preferences")
170-
public AccessorResponse<NotificationPreferences> updateNotificationPreferences(NotificationPreferences notificationPreferences) {
170+
public AccessorResponse<NotificationPreferences> updateNotificationPreferences(String id, NotificationPreferences notificationPreferences) {
171171
throw new AccessorMethodNotImplementedException();
172172
}
173173
}

mdx-web/src/main/java/com/mx/path/model/mdx/web/controller/ManagedCardsController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ public final ResponseEntity<ManagedCard> getCvv(@PathVariable("id") String id) t
9191
}
9292

9393
@RequestMapping(value = "/users/{userId}/managed_cards/{id}/notification_preferences", method = RequestMethod.PUT, consumes = MDX_MEDIA)
94-
public final ResponseEntity<?> updateNotificationPreferences(@RequestBody NotificationPreferences notificationPreferencesRequest) throws Exception {
95-
AccessorResponse<NotificationPreferences> response = gateway().managedCards().updateNotificationPreferences(notificationPreferencesRequest);
94+
public final ResponseEntity<?> updateNotificationPreferences(@PathVariable("id") String id, @RequestBody NotificationPreferences notificationPreferencesRequest) throws Exception {
95+
AccessorResponse<NotificationPreferences> response = gateway().managedCards().updateNotificationPreferences(id, notificationPreferencesRequest);
9696
return new ResponseEntity<>(response.getResult().wrapped(), createMultiMapForResponse(response.getHeaders()), HttpStatus.OK);
9797
}
9898
}

mdx-web/src/test/groovy/com/mx/path/model/mdx/web/controller/ManagedCardsControllerTest.groovy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,13 +212,13 @@ class ManagedCardsControllerTest extends Specification {
212212
NotificationPreferences notificationPreferences = new NotificationPreferences().tap {
213213
setAllowPushNotification(false)
214214
}
215-
doReturn(new AccessorResponse<NotificationPreferences>().withResult(notificationPreferences)).when(managedCardGateway).updateNotificationPreferences(notificationPreferences)
215+
doReturn(new AccessorResponse<NotificationPreferences>().withResult(notificationPreferences)).when(managedCardGateway).updateNotificationPreferences("CARD-123", notificationPreferences)
216216

217217
when:
218-
def response = subject.updateNotificationPreferences(notificationPreferences)
218+
def response = subject.updateNotificationPreferences("CARD-123", notificationPreferences)
219219

220220
then:
221-
verify(managedCardGateway).updateNotificationPreferences(notificationPreferences) || true
221+
verify(managedCardGateway).updateNotificationPreferences("CARD-123", notificationPreferences) || true
222222
response.body == notificationPreferences
223223
HttpStatus.OK == response.statusCode
224224
}

0 commit comments

Comments
 (0)