@@ -397,6 +397,35 @@ describe('QuickBooks master-data reader', () => {
397397 expect ( byIdResult . output . item ) . not . toHaveProperty ( 'TaxIdentifier' )
398398 } )
399399
400+ it ( 'removes customer tax identifiers from list and by-ID output' , async ( ) => {
401+ const customer = {
402+ Id : '4' ,
403+ SyncToken : '1' ,
404+ DisplayName : 'Sanitized Customer' ,
405+ TaxIdentifier : 'sensitive-tax-id' ,
406+ }
407+ const customerParams : QuickBooksReadMasterDataParams = {
408+ ...listParams ,
409+ recordType : 'customer' ,
410+ }
411+
412+ const listResult = await quickbooksReadMasterDataTool . transformResponse ! (
413+ Response . json ( { QueryResponse : { Customer : [ customer ] } } ) ,
414+ customerParams
415+ )
416+ expect ( listResult . output . items ?. [ 0 ] ) . toEqual ( {
417+ Id : '4' ,
418+ SyncToken : '1' ,
419+ DisplayName : 'Sanitized Customer' ,
420+ } )
421+
422+ const byIdResult = await quickbooksReadMasterDataTool . transformResponse ! (
423+ Response . json ( { Customer : customer } ) ,
424+ { ...customerParams , readMode : 'by_id' , recordId : '4' }
425+ )
426+ expect ( byIdResult . output . item ) . not . toHaveProperty ( 'TaxIdentifier' )
427+ } )
428+
400429 it ( 'rejects missing IDs, unknown types and unknown modes before a request' , ( ) => {
401430 const requestUrl = quickbooksReadMasterDataTool . request . url as (
402431 params : QuickBooksReadMasterDataParams
@@ -556,6 +585,27 @@ describe('QuickBooks customer and vendor mutations', () => {
556585 } )
557586 }
558587 } )
588+
589+ it ( 'removes customer tax identifiers from mutation output' , async ( ) => {
590+ const response = {
591+ Customer : {
592+ Id : '22' ,
593+ SyncToken : '0' ,
594+ DisplayName : 'Sanitized Customer' ,
595+ TaxIdentifier : 'sensitive-tax-id' ,
596+ } ,
597+ time : 'test-time' ,
598+ }
599+
600+ for ( const tool of [ quickbooksCreateCustomerTool , quickbooksUpdateCustomerTool ] ) {
601+ const result = await tool . transformResponse ! ( Response . json ( response ) )
602+ expect ( result . output . record ) . toEqual ( {
603+ Id : '22' ,
604+ SyncToken : '0' ,
605+ DisplayName : 'Sanitized Customer' ,
606+ } )
607+ }
608+ } )
559609} )
560610
561611describe ( 'QuickBooks item mutations' , ( ) => {
0 commit comments