Skip to content

Commit 99c026f

Browse files
committed
Added test case when trying to complete an inc payment that has no wallet address
1 parent b0d658f commit 99c026f

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

packages/backend/src/open_payments/receiver/service.test.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff 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
})

0 commit comments

Comments
 (0)