Method: AdvancedBilling::ProformaInvoicesController#void_proforma_invoice

Defined in:
lib/advanced_billing/controllers/proforma_invoices_controller.rb

#void_proforma_invoice(proforma_invoice_uid, body: nil) ⇒ ProformaInvoice

This endpoint will void a proforma invoice that has the status “draft”. ## Restrictions Proforma invoices are only available on Relationship Invoicing sites. Only proforma invoices that have the appropriate status may be reopened. If the invoice identified by uid does not have the appropriate status, the response will have HTTP status code 422 and an error message. A reason for the void operation is required to be included in the request body. If one is not provided, the response will have HTTP status code 422 and an error message. proforma invoice

Parameters:

  • proforma_invoice_uid (String)

    Required parameter: The uid of the

  • body (VoidInvoiceRequest) (defaults to: nil)

    Optional parameter: Example:

Returns:



224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
# File 'lib/advanced_billing/controllers/proforma_invoices_controller.rb', line 224

def void_proforma_invoice(proforma_invoice_uid,
                          body: nil)
  new_api_call_builder
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/proforma_invoices/{proforma_invoice_uid}/void.json',
                                 Server::PRODUCTION)
               .template_param(new_parameter(proforma_invoice_uid, key: 'proforma_invoice_uid')
                                .is_required(true)
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('BasicAuth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ProformaInvoice.method(:from_hash))
                .local_error_template('404',
                                      'Not Found:\'{$response.body}\'',
                                      APIException)
                .local_error_template('422',
                                      'HTTP Response Not OK. Status code: {$statusCode}.'\
                                       ' Response: \'{$response.body}\'.',
                                      ErrorListResponseException))
    .execute
end