Surface original Vertex errors via new bang methods #75
+120
−14
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Stakeholder Overview (learn more)
As part of the Hybrid GO Migration work in stores, we've begun issuing tax distributions at the time of fulfillment of items to account for any changes to shipping address and tax amount between the time of purchase and the time of fulfillment.
That tax distribution process is ignorant of the prior state of the tax invoice originally reported to Vertex, and relies on idempotency to correct the tax invoice data in Vertex.
While this has worked well in most cases, we found that the Vertex API rejects tax distribution requests with an error response if there is no difference to the tax invoice data in Vertex vs. the data in the new tax distribution request.
Today, this results in a generic
VertexClient::ServerError
returned by the VertexClient to the stores app due to the masking of the raw Vertex API error via thefallback_response
structure within the resource models.While the raw error message returned by Vertex in this case is:
In order to differentiate this error with other errors related to Vertex API outages, etc. and handle this case accordingly (no-op, prevent reprocessing of jobs) we need access to the raw error message returned by Vertex.
We achieve this by adding
!
request methods that bypass thefallback_response
structure of the existing request methods and raising the lower level Savon::SOAPFault error to the application. The specific error type and message can then be accessed via the to_hash method and custom error handling can be performed.Risk Estimate (learn more)
Relatively low risk as this is mostly the addition of new methods alongside existing ones, with release controlled by gem versioning.
Changes
quotation!
,invoice!
,distribute_tax!
,tax_area!
class methods toVertexClient
that raiseSavon::SOAPFault
errors when errors are returned from the Vertex SOAP APINotes
Relies on the Circuitbox circuit
exception
option, which was previously set tofalse
across the boardLibrary-Specific