@@ -31,6 +31,10 @@ import { createOutgoingPayment } from '../../../tests/outgoingPayment'
3131import { createWalletAddress } from '../../../tests/walletAddress'
3232import { UnionOmit } from '../../../shared/utils'
3333import { OpenPaymentsServerRouteError } from '../../route-errors'
34+ import { createTenant } from '../../../tests/tenant'
35+ import { EndpointType } from '../../../tenant/endpoints/model'
36+
37+ const nock = ( global as unknown as { nock : typeof import ( 'nock' ) } ) . nock
3438
3539describe ( 'Outgoing Payment Routes' , ( ) : void => {
3640 let deps : IocContract < AppServices >
@@ -41,6 +45,7 @@ describe('Outgoing Payment Routes', (): void => {
4145 let outgoingPaymentService : OutgoingPaymentService
4246 let walletAddress : WalletAddress
4347 let baseUrl : string
48+ let tenantId : string
4449
4550 const receivingWalletAddress = `https://wallet.example/${ uuid ( ) } `
4651
@@ -52,6 +57,7 @@ describe('Outgoing Payment Routes', (): void => {
5257 return await createOutgoingPayment ( deps , {
5358 ...options ,
5459 walletAddressId : walletAddress . id ,
60+ tenantId,
5561 method : 'ilp' ,
5662 receiver : `${ receivingWalletAddress } /incoming-payments/${ uuid ( ) } ` ,
5763 debitAmount : {
@@ -77,7 +83,25 @@ describe('Outgoing Payment Routes', (): void => {
7783
7884 beforeEach ( async ( ) : Promise < void > => {
7985 const asset = await createAsset ( deps )
80- walletAddress = await createWalletAddress ( deps , { assetId : asset . id } )
86+ const tenantEmail = faker . internet . email ( )
87+ nock ( config . kratosAdminUrl )
88+ . get ( '/identities' )
89+ . query ( { credentials_identifier : tenantEmail } )
90+ . reply ( 200 , [ { id : uuid ( ) , metadata_public : { } } ] )
91+ . persist ( )
92+ tenantId = (
93+ await createTenant ( deps , {
94+ email : tenantEmail ,
95+ idpSecret : 'testsecret' ,
96+ idpConsentEndpoint : faker . internet . url ( ) ,
97+ endpoints : [
98+ { type : EndpointType . WebhookBaseUrl , value : faker . internet . url ( ) }
99+ ]
100+ } )
101+ ) . id
102+ walletAddress = await createWalletAddress ( deps , tenantId , {
103+ assetId : asset . id
104+ } )
81105 baseUrl = new URL ( walletAddress . url ) . origin
82106 } )
83107
@@ -282,6 +306,7 @@ describe('Outgoing Payment Routes', (): void => {
282306 async ( error ) : Promise < void > => {
283307 const quoteId = uuid ( )
284308 const ctx = setup ( {
309+ tenantId,
285310 quoteId : `${ baseUrl } /quotes/${ quoteId } `
286311 } )
287312 const createSpy = jest
0 commit comments