getUserPurchases static method

Future getUserPurchases()

Implementation

static Future getUserPurchases() async {
    try {

      final jsonData = await StoreBountyInit.readJsonFromRoot();


      final response = await HttpClientClass
          .getRequestWithAuthWithToken("${jsonData['BASE_URL']}/marketplace/v1/mobile/${jsonData['STORE_ID']}/purchases");

      // print(response.body);
      if (response.statusCode == 200) {

        return response;
      } else if (response.statusCode == 412) {
        var error = jsonDecode(response.body);
        throw StoreBountyException(error['message']);
      } else {
        throw StoreBountyException("Unknown error");
      }
    } catch (e) {
      throw StoreBountyException("$e");
    }
  }