deleteBankAccount method

Future<Response<RazorpayCustomerBankAccount>> deleteBankAccount({
  1. required String customerId,
  2. required String bankAccountId,
  3. void callback(
    1. RazorpayApiException?,
    2. Response<RazorpayCustomerBankAccount>?
    )?,
})

Delete Bank Account of Customer

@param customerId - The unique identifier of the customer. @param bankAccountId - The bank_id that needs to be deleted.

Implementation

Future<Response<RazorpayCustomerBankAccount>> deleteBankAccount({
  // Assuming it returns the deleted object or success status
  required String customerId,
  required String bankAccountId,
  void Function(
    RazorpayApiException?,
    Response<RazorpayCustomerBankAccount>?,
  )? callback,
}) async {
  if (customerId.isEmpty) {
    throw ArgumentError('customerId is required');
  }
  if (bankAccountId.isEmpty) {
    throw ArgumentError('bankAccountId is required');
  }
  // API might return empty body, adjust T if necessary
  return api.delete<RazorpayCustomerBankAccount>(
    {'url': '/customers/$customerId/bank_account/$bankAccountId'},
    fromJsonFactory: RazorpayCustomerBankAccount
        .fromJson, // Adjust if response is different
    callback: callback,
  );
}