editFulfillment method

Future<Response<RazorpayFulFillment>> editFulfillment({
  1. required String orderId,
  2. required RazorpayFulFillmentBaseRequestBody params,
  3. void callback(
    1. RazorpayApiException?,
    2. Response<RazorpayFulFillment>?
    )?,
})

Update the Fulfillment Details

@param orderId - The unique identifier of the order @param params - Check doc for required params

Implementation

Future<Response<RazorpayFulFillment>> editFulfillment({
  // Assuming response matches RazorpayFulFillment model
  required String orderId,
  required RazorpayFulFillmentBaseRequestBody params,
  void Function(RazorpayApiException?, Response<RazorpayFulFillment>?)?
      callback,
}) async {
  if (orderId.isEmpty) {
    throw ArgumentError('`order_id` is mandatory');
  }
  // JS returns 'any', using the defined fulfillment model.
  return api.post<RazorpayFulFillment>(
    {
      'url': '/orders/$orderId/fulfillment',
      'data': params.toJson(),
    },
    fromJsonFactory:
        RazorpayFulFillment.fromJson, // Adjust if response differs
    callback: callback,
  );
}