File tree Expand file tree Collapse file tree
packages/backend/src/open_payments/receiver Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -591,6 +591,37 @@ describe('Receiver Service', (): void => {
591591 isLocal : true
592592 } )
593593 } )
594+
595+ test ( 'returns error when incoming payment has no wallet address' , async ( ) => {
596+ const walletAddress = await createWalletAddress ( deps , {
597+ tenantId : Config . operatorTenantId ,
598+ mockServerPort : Config . openPaymentsPort
599+ } )
600+ const incomingPayment = await createIncomingPayment ( deps , {
601+ walletAddressId : walletAddress . id ,
602+ incomingAmount : {
603+ value : BigInt ( 5 ) ,
604+ assetCode : walletAddress . asset . code ,
605+ assetScale : walletAddress . asset . scale
606+ } ,
607+ tenantId : Config . operatorTenantId ,
608+ initiationReason : IncomingPaymentInitiationReason . Admin
609+ } )
610+
611+ jest
612+ . spyOn ( paymentMethodProviderService , 'getPaymentMethods' )
613+ . mockResolvedValueOnce ( [ ] )
614+
615+ delete incomingPayment . walletAddress
616+ jest
617+ . spyOn ( incomingPaymentService , 'complete' )
618+ . mockResolvedValueOnce ( incomingPayment )
619+ await expect (
620+ receiverService . complete (
621+ incomingPayment . getUrl ( config . openPaymentsUrl )
622+ )
623+ ) . resolves . toEqual ( IncomingPaymentError . UnknownWalletAddress )
624+ } )
594625 } )
595626 } )
596627} )
You can’t perform that action at this time.
0 commit comments