feat: Validate transfer transaction data
          #10
        
          
      
                
     Merged
            
            
          
  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.
  
    
  
    
Description
The
narrativefield on the transaction data used in thetransfermodule is truncated by default for strings that exceed 22 characters. No documentation or info about this behavior exists to inform developers concerning a field used in the SMS notification for a successful transaction. This branch introduces a patch to raise if a user attempts to use a string exceeding the limit to avoid incomplete or obscure data passed to the customer/end-user.Fixes:
n/aBelow are examples of truncated narratives in the SMS notification from Intasend on a successful transaction for a live account.
Decisions
warning(non-blocking) may be more favorable to raising an exception (blocking). However, this requires configuring logging and that users observe these logs.Testing
The following unit test was written to validate the function responsible for raising the exception.
Note: The test module was omitted from the PR given no tests are included in this package.
Additional
General
Recommended change improvements:
Check if applicable:
accountandamountto use the correct type.The docs and example code for transaction data specify the fields
accountandamountas typeint- which will result in a400 BAD REQUESTresponse - instead of the correct and expected type,str.black.The codebase uses a custom format that is difficult to read. Using a recommended and opinionated formatter, such as
black, ensures that the src resembles the majority of Python code, improving readability.amountis below the minimum required,10.This applies the same validation logic used for the
narrativefield to increase user feedback.