Skip to content
Open
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 @@ -20,20 +20,19 @@

import static org.awaitility.Awaitility.await;

import com.google.gson.Gson;
import io.restassured.specification.FilterableRequestSpecification;
import io.restassured.specification.RequestSpecification;
import io.restassured.specification.ResponseSpecification;
import java.time.Duration;
import java.util.HashMap;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
import org.apache.fineract.client.models.GetNotificationsResponse;
import org.apache.fineract.client.util.JSON;
import org.apache.fineract.client.util.Calls;

@Slf4j
public final class NotificationHelper {

private static final String NOTIFICATION_API_URL = "/fineract-provider/api/v1/notifications?" + Utils.TENANT_IDENTIFIER;
private static final Gson GSON = new JSON().getGson();

private NotificationHelper() {}

// TODO: Rewrite to use fineract-client instead!
Expand All @@ -42,10 +41,15 @@ private NotificationHelper() {}
@Deprecated(forRemoval = true)
public static GetNotificationsResponse getNotifications(final RequestSpecification requestSpec,
final ResponseSpecification responseSpec) {
final String GET_NOTIFICATIONS_URL = NOTIFICATION_API_URL;
log.info("-----------------------------GET NOTIFICATIONS-----------------------------------");
String response = Utils.performServerGet(requestSpec, responseSpec, GET_NOTIFICATIONS_URL);
return GSON.fromJson(response, GetNotificationsResponse.class);

FilterableRequestSpecification filterableRequestSpec = (FilterableRequestSpecification) requestSpec;

Map<String, String> headers = new HashMap<>();
headers.put("Authorization", filterableRequestSpec.getHeaders().getValue("Authorization"));
headers.put("Fineract-Platform-TenantId", filterableRequestSpec.getHeaders().getValue("Fineract-Platform-TenantId"));

return Calls.ok(FineractClientHelper.getFineractClient().notifications.getAllNotifications(null, 1, 0, null, null, headers));
}

// TODO: Rewrite to use fineract-client instead!
Expand Down
Loading