Class: Avatax::Api::Transactions
- Defined in:
- lib/avatax/api/transactions.rb
Overview
Transactions client
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#adjust(company_code, transaction_code, args = {}) ⇒ Avatax::Response
Adjust a transaction.
-
#all(company_code, args = {}) ⇒ Avatax::Response
Get all transactions within a company.
-
#change_code(company_code, transaction_code, args = {}) ⇒ Avatax::Response
Change a transaction code.
-
#commit(company_code, transaction_code, args = {}) ⇒ Avatax::Response
Commit a transaction.
-
#create(args = {}) ⇒ Avatax::Response
Create a transaction.
-
#create_or_adjust(args = {}) ⇒ Avatax::Response
Create or Adjust a transaction if transaction already exists.
-
#find_by_code(company_code, transaction_code, args = {}) ⇒ Avatax::Response
Get a transaction by code.
-
#find_by_id(transaction_id, args = {}) ⇒ Avatax::Response
Get a transaction by code.
-
#lock(company_code, transaction_code, args = {}) ⇒ Avatax::Response
Lock a transaction.
-
#refund(company_code, transaction_code, args = {}) ⇒ Avatax::Response
Refund a transaction.
-
#settle(company_code, transaction_code, args = {}) ⇒ Avatax::Response
Settle a transaction.
-
#verify(company_code, transaction_code, args = {}) ⇒ Avatax::Response
Verify a transaction.
-
#void(company_code, transaction_code, args = {}) ⇒ Avatax::Response
Void a transaction.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Avatax::Api::Base
Instance Method Details
#adjust(company_code, transaction_code, args = {}) ⇒ Avatax::Response
Adjust a transaction
65 66 67 |
# File 'lib/avatax/api/transactions.rb', line 65 def adjust(company_code, transaction_code, args = {}) post_for(:adjust, company_code, transaction_code, args) end |
#all(company_code, args = {}) ⇒ Avatax::Response
Get all transactions within a company.
16 17 18 19 20 21 |
# File 'lib/avatax/api/transactions.rb', line 16 def all(company_code, args = {}) raise ArgumentError, 'company_code is required' if company_code.blank? resp = connection.get "/api/v2/companies/#{company_code}/transactions/", args handle_response(resp) end |
#change_code(company_code, transaction_code, args = {}) ⇒ Avatax::Response
Change a transaction code
78 79 80 |
# File 'lib/avatax/api/transactions.rb', line 78 def change_code(company_code, transaction_code, args = {}) post_for(:changecode, company_code, transaction_code, args) end |
#commit(company_code, transaction_code, args = {}) ⇒ Avatax::Response
Commit a transaction
91 92 93 94 |
# File 'lib/avatax/api/transactions.rb', line 91 def commit(company_code, transaction_code, args = {}) args.reverse_merge!(commit: true) post_for(:commit, company_code, transaction_code, args) end |
#create(args = {}) ⇒ Avatax::Response
Create a transaction
156 157 158 159 |
# File 'lib/avatax/api/transactions.rb', line 156 def create(args = {}) resp = connection.post '/api/v2/transactions/create', args handle_response(resp) end |
#create_or_adjust(args = {}) ⇒ Avatax::Response
Create or Adjust a transaction if transaction already exists.
168 169 170 171 |
# File 'lib/avatax/api/transactions.rb', line 168 def create_or_adjust(args = {}) resp = connection.post '/api/v2/transactions/createoradjust', args handle_response(resp) end |
#find_by_code(company_code, transaction_code, args = {}) ⇒ Avatax::Response
Get a transaction by code
32 33 34 35 36 37 38 |
# File 'lib/avatax/api/transactions.rb', line 32 def find_by_code(company_code, transaction_code, args = {}) raise ArgumentError, 'company_code is required' if company_code.blank? raise ArgumentError, 'transaction_code is required' if transaction_code.blank? resp = connection.get "/api/v2/companies/#{company_code}/transactions/#{transaction_code}", args handle_response(resp) end |
#find_by_id(transaction_id, args = {}) ⇒ Avatax::Response
Get a transaction by code
49 50 51 52 53 54 |
# File 'lib/avatax/api/transactions.rb', line 49 def find_by_id(transaction_id, args = {}) raise ArgumentError, 'transaction_id is required' if transaction_id.blank? resp = connection.get "/api/v2/transactions/#{transaction_id}", args handle_response(resp) end |
#lock(company_code, transaction_code, args = {}) ⇒ Avatax::Response
Lock a transaction
182 183 184 185 |
# File 'lib/avatax/api/transactions.rb', line 182 def lock(company_code, transaction_code, args = {}) args.reverse_merge!(isLocked: true) post_for(:lock, company_code, transaction_code, args) end |
#refund(company_code, transaction_code, args = {}) ⇒ Avatax::Response
Refund a transaction
145 146 147 |
# File 'lib/avatax/api/transactions.rb', line 145 def refund(company_code, transaction_code, args = {}) post_for(:refund, company_code, transaction_code, args) end |
#settle(company_code, transaction_code, args = {}) ⇒ Avatax::Response
Settle a transaction
105 106 107 |
# File 'lib/avatax/api/transactions.rb', line 105 def settle(company_code, transaction_code, args = {}) post_for(:settle, company_code, transaction_code, args) end |
#verify(company_code, transaction_code, args = {}) ⇒ Avatax::Response
Verify a transaction
118 119 120 |
# File 'lib/avatax/api/transactions.rb', line 118 def verify(company_code, transaction_code, args = {}) post_for(:verify, company_code, transaction_code, args) end |
#void(company_code, transaction_code, args = {}) ⇒ Avatax::Response
Void a transaction
131 132 133 134 |
# File 'lib/avatax/api/transactions.rb', line 131 def void(company_code, transaction_code, args = {}) args.reverse_merge!(code: Avatax::Code::DOC_VOIDED) post_for(:void, company_code, transaction_code, args) end |