Class: Cetustek::CreateInvoice

Inherits:
Object
  • Object
show all
Defined in:
lib/cetustek/create_invoice.rb

Overview

2.1 CreateInvoiceV3 開立發票. Returns the issued invoice on success and raises ResultError otherwise. Persisting the result is the caller's job.

Instance Method Summary collapse

Constructor Details

#initialize(invoice_data) ⇒ CreateInvoice

Returns a new instance of CreateInvoice.



12
13
14
# File 'lib/cetustek/create_invoice.rb', line 12

def initialize(invoice_data)
  @invoice_data = invoice_data
end

Instance Method Details

#executeObject



16
17
18
19
20
# File 'lib/cetustek/create_invoice.rb', line 16

def execute
  xml = Services::InvoiceXmlBuilder.new(@invoice_data).build
  response = Services::InvoiceService.new(xml, @invoice_data.hastax).create
  Services::ResponseHandler.new(response, @invoice_data, xml).process
end