Cetustek
Cetustek is a Ruby gem designed for handling electronic invoice operations, including invoice cancellation. It communicates with the e-invoice system through SOAP Web Services.
Features
- Electronic invoice cancellation
- XML format generation
- SOAP Web Services integration
- Environment-specific configuration (sandbox/production)
- Service-oriented architecture
- Robust error handling
Installation
Add this line to your application's Gemfile:
gem 'cetustek'
Then execute:
bundle install
Configuration
Configure Cetustek in your application:
# config/initializers/cetustek.rb
Cetustek.configure do |config|
# Set environment (:production or :sandbox)
config.environment = Rails.env.production? ? :production : :sandbox
# Set authentication credentials
config.site_id = ENV['CETUSTEK_SITE_ID']
config.username = ENV['CETUSTEK_USERNAME']
config.password = ENV['CETUSTEK_PASSWORD']
end
Usage
Cancel an Invoice
invoice = YourInvoiceModel.find(invoice_id)
invoice_data = Cetustek::Models::InvoiceData.new(
order_id: invoice.order_id,
order_date: Time.zone.today,
buyer_identifier: invoice.receipt,
buyer_name: invoice.name,
buyer_email: invoice.email,
items: invoice.items.map { |item|
Cetustek::Models::InvoiceItem.new(
code: item.sku,
name: item.name,
quantity: item.quantity,
unit_price: item.price
)
}
)
result = Cetustek::CreateInvoice.new(invoice_data).execute
Development
- Clone this repository
- Run
bin/setup
to install dependencies - Run
bin/console
for an interactive prompt to experiment
Requirements
- Ruby >= 2.7.0
-
ox
gem for XML processing -
savon
gem for SOAP services
Contributing
- Fork this project
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -am 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
Versioning
This project follows Semantic Versioning. See the CHANGELOG.md file for version details.
License
This gem is available as open source under the terms of the MIT License.