responseMethod method

void responseMethod(
  1. dynamic value
)

Implementation

void responseMethod(dynamic value) {
  if(value != null) {
    final body = json.decode(value);
    var status = body["status"] as String;
    switch (status) {
      case "exception":
        var data = body["data"] as Map<String, dynamic>;
        _createErrorResponse(data["message"] as String, null, null, null);
        break;
      case "success":
        var data = body["data"] as Map<String, dynamic>;
        verifyPayment!(data["order_id"] as String);
        break;
      case "failed":
        var data = body["data"] as Map<String, dynamic>;
        var errorResponse = CFErrorResponse(
            data["status"] as String, data["message"] as String,
            data["code"] as String, data["type"] as String);
        onError!(errorResponse, data["order_id"] as String);
        break;
    }
  }
}