updateCVV method
Implementation
Future<SuccessResponse> updateCVV(CardInfo cardInfo, String gid) async {
var successResponse = SuccessResponse();
var url = Constant.baseURL + Constant.getCard + gid;
final response = await http
.patch(Uri.parse(url), body: jsonEncode(cardInfo.toMap()), headers: {
"Content-Type": "application/json",
"accept": "application/json",
"x-api-key": SwirepaySdk.secretKey
});
final result = jsonDecode(response.body);
var paymentMethod = PaymentMethodCard.fromJson(result["entity"]);
successResponse.responseCode = "${response.statusCode}";
successResponse.responseBody = response.statusCode == 200
? result["entity"]
: result;
successResponse.content = response.statusCode == 200 &&
result != null &&
result.toString().isNotEmpty
? paymentMethod
: [];
return successResponse;
}