fetch method

Future<Response<RazorpayFundAccountFetchResponse>> fetch({
  1. required String customerId,
  2. void callback(
    1. RazorpayApiException?,
    2. Response<RazorpayFundAccountFetchResponse>?
    )?,
})

Fetch all Fund Accounts for a Customer

@param customerId - The unique identifier of the customer

Implementation

Future<Response<RazorpayFundAccountFetchResponse>> fetch({
  required String customerId,
  void Function(
    RazorpayApiException?,
    Response<RazorpayFundAccountFetchResponse>?,
  )? callback,
}) async {
  if (customerId.isEmpty) {
    throw ArgumentError('Customer Id is mandatory');
  }

  return api.get<RazorpayFundAccountFetchResponse>(
    {
      'url': '/fund_accounts', // Query param added below
      'data': {
        'customer_id': customerId,
      }, // Pass customerId as query parameter
    },
    fromJsonFactory: RazorpayFundAccountFetchResponse.fromJson,
    callback: callback,
  );
}