Class: SpreeAvataxOfficial::Transactions::CreateService
- Defined in:
- app/services/spree_avatax_official/transactions/create_service.rb
Constant Summary
Constants inherited from Base
Base::APP_NAME, Base::APP_VERSION, Base::CONNECTION_OPTIONS, Base::SUCCESS_STATUSES
Instance Method Summary collapse
-
#call(order:, options: {}) ⇒ Object
rubocop:disable Metrics/MethodLength.
Instance Method Details
#call(order:, options: {}) ⇒ Object
rubocop:disable Metrics/MethodLength
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/services/spree_avatax_official/transactions/create_service.rb', line 4 def call(order:, options: {}) # rubocop:disable Metrics/MethodLength return failure(false) unless can_send_order_to_avatax?(order) transaction_type = choose_transaction_type(order) response = send_request(order, transaction_type, ) request_result(response, order) do if order.completed? && response.body['id'].to_i.positive? create_transaction!( order: order, transaction_type: transaction_type ) end end end |