delete method

dynamic delete({
  1. required String cardId,
  2. required void onDelete(),
  3. required void onError(),
})

Implementation

delete(
    {required String cardId,
    required void Function() onDelete,
    required void Function() onError}) {
  String url = isTestMode
      ? "https://uatcheckout.thawani.om/api/v1/payment_methods/$cardId"
      : "https://checkout.thawani.om/api/v1/payment_methods/$cardId";

  Request.delete(url: url, data: {}, headers: {
    'Content-Type': "application/json",
    'thawani-api-key': userApiKey
  }).then((value) => {
        if (value['data']['code'] == 2003) {onDelete()} else {}
      });
}