@@ -652,102 +652,6 @@ describe('Open Payments Wallet Address Service', (): void => {
652652 )
653653 )
654654
655- test (
656- 'creates wallet address not found event for tenant with matching prefix' ,
657- withConfigOverride (
658- ( ) => config ,
659- { walletAddressLookupTimeoutMs : 0 } ,
660- async ( ) : Promise < void > => {
661- const walletAddressUrl = `https://${ faker . internet . domainName ( ) } /.well-known/pay`
662- const tenant = await createTenant ( deps )
663- await createTenantSettings ( deps , {
664- tenantId : tenant . id ,
665- setting : [
666- {
667- key : TenantSettingKeys . WALLET_ADDRESS_URL . name ,
668- value : `${ walletAddressUrl } /${ uuid ( ) } `
669- }
670- ]
671- } )
672-
673- await expect (
674- walletAddressService . getOrPollByUrl ( walletAddressUrl )
675- ) . resolves . toBeUndefined ( )
676-
677- const walletAddressNotFoundEvents = await WalletAddressEvent . query (
678- knex
679- )
680- . where ( {
681- type : WalletAddressEventType . WalletAddressNotFound
682- } )
683- . withGraphFetched ( 'webhooks' )
684-
685- expect ( walletAddressNotFoundEvents ) . toHaveLength ( 1 )
686- expect ( walletAddressNotFoundEvents [ 0 ] . webhooks ) . toHaveLength ( 1 )
687- expect ( walletAddressNotFoundEvents [ 0 ] ) . toMatchObject ( {
688- data : { walletAddressUrl } ,
689- webhooks : expect . arrayContaining ( [
690- expect . objectContaining ( {
691- recipientTenantId : tenant . id ,
692- eventId : walletAddressNotFoundEvents [ 0 ] . id ,
693- processAt : expect . any ( Date )
694- } )
695- ] )
696- } )
697- }
698- )
699- )
700-
701- test (
702- 'creates wallet address not found event for tenant with matching prefix' ,
703- withConfigOverride (
704- ( ) => config ,
705- { walletAddressLookupTimeoutMs : 0 } ,
706- async ( ) : Promise < void > => {
707- const walletAddressUrl = `https://${ faker . internet . domainName ( ) } /.well-known/pay`
708- const tenant = await createTenant ( deps )
709- await createTenantSettings ( deps , {
710- tenantId : tenant . id ,
711- setting : [
712- {
713- key : TenantSettingKeys . WALLET_ADDRESS_URL . name ,
714- value : `${ walletAddressUrl } /${ uuid ( ) } `
715- }
716- ]
717- } )
718-
719- await expect (
720- walletAddressService . getOrPollByUrl ( walletAddressUrl )
721- ) . resolves . toBeUndefined ( )
722-
723- const walletAddressNotFoundEvents = await WalletAddressEvent . query (
724- knex
725- )
726- . where ( {
727- type : WalletAddressEventType . WalletAddressNotFound
728- } )
729- . withGraphFetched ( 'webhooks' )
730-
731- expect ( walletAddressNotFoundEvents ) . toHaveLength ( 1 )
732- expect ( walletAddressNotFoundEvents [ 0 ] . webhooks ) . toHaveLength ( 2 )
733- expect ( walletAddressNotFoundEvents [ 0 ] ) . toMatchObject ( {
734- data : { walletAddressUrl } ,
735- webhooks : expect . arrayContaining ( [
736- expect . objectContaining ( {
737- recipientTenantId : tenant . id ,
738- eventId : walletAddressNotFoundEvents [ 0 ] . id ,
739- processAt : expect . any ( Date )
740- } ) ,
741- expect . objectContaining ( {
742- recipientTenantId : config . operatorTenantId ,
743- eventId : walletAddressNotFoundEvents [ 0 ] . id ,
744- processAt : expect . any ( Date )
745- } )
746- ] )
747- } )
748- }
749- )
750- )
751655 test (
752656 'polls for wallet address' ,
753657 withConfigOverride (
@@ -931,50 +835,6 @@ describe('Open Payments Wallet Address Service', (): void => {
931835 } )
932836 } )
933837
934- test ( 'creates corresponding operator webhook if withdrawal event is for tenant' , async ( ) : Promise < void > => {
935- const tenant = await createTenant ( deps )
936- const walletAddress = await createWalletAddress ( deps , {
937- tenantId : tenant . id ,
938- createLiquidityAccount : true
939- } )
940-
941- accountingService . createDeposit ( {
942- id : uuid ( ) ,
943- account : walletAddress ,
944- amount : BigInt ( 10 )
945- } )
946-
947- await walletAddress . $query ( knex ) . patch ( {
948- processAt : new Date ( ) ,
949- totalEventsAmount : BigInt ( 0 )
950- } )
951- await expect ( walletAddressService . processNext ( ) ) . resolves . toBe (
952- walletAddress . id
953- )
954-
955- const events = await WalletAddressEvent . query ( knex )
956- . where ( {
957- type : WalletAddressEventType . WalletAddressWebMonetization ,
958- withdrawalAccountId : walletAddress . id ,
959- withdrawalAssetId : walletAddress . assetId ,
960- withdrawalAmount : BigInt ( 10 )
961- } )
962- . withGraphFetched ( 'webhooks' )
963- expect ( events ) . toHaveLength ( 1 )
964- expect ( events [ 0 ] . webhooks ) . toEqual ( [
965- expect . objectContaining ( {
966- recipientTenantId : walletAddress . tenantId ,
967- eventId : events [ 0 ] . id ,
968- processAt : expect . any ( Date )
969- } ) ,
970- expect . objectContaining ( {
971- recipientTenantId : config . operatorTenantId ,
972- eventId : events [ 0 ] . id ,
973- processAt : expect . any ( Date )
974- } )
975- ] )
976- } )
977-
978838 test . each `
979839 processAt | description
980840 ${ null } | ${ 'not scheduled' }
0 commit comments