kfGetAddressesByPhone static method

Future kfGetAddressesByPhone({
  1. required String phone,
  2. required String userAuthToken,
  3. bool consent = true,
})

Fetches saved addresses for a phone number. Uses muToken header for standalone (kwikforms) mode auth.

Implementation

static Future<dynamic> kfGetAddressesByPhone({
  required String phone,
  required String userAuthToken,
  bool consent = true,
}) async {
  // Gate first: a blocked call leaves no side effects, and sits outside
  // _withRetry so a 503 isn't retried.
  await checkKwikFormsHealth();
  return _withRetry(() async {
    final gokwik = DioClient().getClient();
    final response = await gokwik.post(
      cdnConfigInstance.getEndpoint(APIEndpointKeys.kfGetAddressesByPhone)!,
      data: {'phone': phone, 'consent': consent},
      options: Options(headers: {
        APIHeader.muToken: userAuthToken,
      }),
    );
    return response.data;
  });
}