Add TAPI utility helpers for PredefinedContent and SaleToAcquirerData#1913
Open
Add TAPI utility helpers for PredefinedContent and SaleToAcquirerData#1913
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces several helper classes—PredefinedContentHelper, SaleDataHelper, and SaleToAcquirerData—to handle the parsing of terminal API data, including URL query-like strings and SaleToAcquirerData in both Base64-encoded JSON and form-encoded formats. The review feedback highlights an opportunity to improve efficiency by avoiding redundant Base64 decoding in SaleDataHelper and suggests explicitly defining the UTF-8 charset when converting bytes to strings in SaleToAcquirerData for better environment consistency.
27e02df to
4e32d8e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Introduces hand-written utility helpers in
com.adyen.util.tapito work with fields from the auto-generated TAPI models that require additional parsing logic:PredefinedContent.ReferenceIDstring with URL query string formatSaleData.SaleToAcquirerDatastring with either JSON or key-value pairsNew classes
PredefinedContentHelperParses the
PredefinedContent.ReferenceIDURL query string into typed accessors:getEvent(),getTransactionId(),getTimeStamp(), andget(key).SaleToAcquirerDataA Jackson-based POJO representing the decoded acquirer data. Supports both formats described in the Adyen docs:
fromBase64)fromKeyValuePairs)SaleDataHelperWraps a
tapi.SaleDatainstance and exposesgetSaleToAcquirerData(), auto-detecting the format of the underlying string.Notes
com.adyen.model.tapiwhich is auto-generated from the OpenAPI speccom.adyen.model.terminalpackagejava.util.Base64and Jackson throughout, consistent with the rest of the TAPI stack