Class: DigiwinDsp::Webhooks::InvoiceUpdate

Inherits:
Event
  • Object
show all
Defined in:
lib/digiwin_dsp/webhooks/invoice_update.rb

Overview

Fired by DSP when one or more ERP-issued invoices land. Unlike the other two events, the request payload is an Array (DSP batches invoices). See docs/dsp-specs/DSPOOFFICIAL100.yaml under “發票資料更新 invoice/update”.

Instance Attribute Summary

Attributes inherited from Event

#digi_header, #raw, #request

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Event

extract_request, #initialize, parse_json

Constructor Details

This class inherits a constructor from DigiwinDsp::Webhooks::Event

Class Method Details

.parse(raw_body) ⇒ Object

Raises:



10
11
12
13
14
15
# File 'lib/digiwin_dsp/webhooks/invoice_update.rb', line 10

def self.parse(raw_body)
  event = super
  raise ParseError, "invoice/update payload must be an array of invoice records" unless event.request.is_a?(Array)

  event
end

Instance Method Details

#invoicesObject



17
# File 'lib/digiwin_dsp/webhooks/invoice_update.rb', line 17

def invoices = request