Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if transaction is present before creating that #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions app/models/spree/taxjar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@ def create_transaction_for_order
if has_nexus?
api_params = transaction_parameters
SpreeTaxjar::Logger.log(__method__, {order: {id: @order.id, number: @order.number}, api_params: api_params}) if SpreeTaxjar::Logger.logger_enabled?
api_response = @client.create_order(api_params)
SpreeTaxjar::Logger.log(__method__, {order: {id: @order.id, number: @order.number}, api_response: api_response}) if SpreeTaxjar::Logger.logger_enabled?
api_response
begin
api_response = @client.create_order(api_params)
SpreeTaxjar::Logger.log(__method__, {order: {id: @order.id, number: @order.number}, api_response: api_response}) if SpreeTaxjar::Logger.logger_enabled?
api_response
rescue
SpreeTaxjar::Logger.log(__method__, {order: {id: @order.id, number: @order.number}, api_response: 'Response with an error'}) if SpreeTaxjar::Logger.logger_enabled?
end
end
end

Expand Down