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
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public AccessorResponse<ManagedCard> update(String id, ManagedCard card) {
*/
@GatewayAPI
@API(description = "Update a managed card's notification preferences")
public AccessorResponse<NotificationPreferences> updateNotificationPreferences(NotificationPreferences notificationPreferences) {
public AccessorResponse<NotificationPreferences> updateNotificationPreferences(String id, NotificationPreferences notificationPreferences) {
throw new AccessorMethodNotImplementedException();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ public final ResponseEntity<ManagedCard> 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<NotificationPreferences> response = gateway().managedCards().updateNotificationPreferences(notificationPreferencesRequest);
public final ResponseEntity<?> updateNotificationPreferences(@PathVariable("id") String id, @RequestBody NotificationPreferences notificationPreferencesRequest) throws Exception {
AccessorResponse<NotificationPreferences> response = gateway().managedCards().updateNotificationPreferences(id, notificationPreferencesRequest);
return new ResponseEntity<>(response.getResult().wrapped(), createMultiMapForResponse(response.getHeaders()), HttpStatus.OK);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,13 @@ class ManagedCardsControllerTest extends Specification {
NotificationPreferences notificationPreferences = new NotificationPreferences().tap {
setAllowPushNotification(false)
}
doReturn(new AccessorResponse<NotificationPreferences>().withResult(notificationPreferences)).when(managedCardGateway).updateNotificationPreferences(notificationPreferences)
doReturn(new AccessorResponse<NotificationPreferences>().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
}
Expand Down