edit method

Future<Response<RazorpayInvoice>> edit({
  1. required String invoiceId,
  2. required RazorpayInvoiceUpdateRequestBody params,
  3. void callback(
    1. RazorpayApiException?,
    2. Response<RazorpayInvoice>?
    )?,
})

Patches given invoice with new attributes

@param invoiceId - The unique identifier of the invoice @param params - Check doc for required params

Implementation

Future<Response<RazorpayInvoice>> edit({
  required String invoiceId,
  required RazorpayInvoiceUpdateRequestBody params,
  void Function(RazorpayApiException?, Response<RazorpayInvoice>?)? callback,
}) async {
  if (invoiceId.isEmpty) {
    throw ArgumentError(MISSING_ID_ERROR);
  }
  final url = '$BASE_URL/$invoiceId';
  return api.patch<RazorpayInvoice>(
    {
      'url': url,
      'data': params.toJson(),
    },
    fromJsonFactory: RazorpayInvoice.fromJson,
    callback: callback,
  );
}