fix purchase_create

This commit is contained in:
Lex Berezhny 2020-03-22 12:23:21 -04:00
parent 61d02fc5d7
commit b11184de68
3 changed files with 5 additions and 5 deletions

View file

@ -2155,11 +2155,11 @@ class Daemon(metaclass=JSONRPCServerType):
accounts = wallet.get_accounts_or_all(funding_account_ids)
txo = None
if claim_id:
txo = await self.ledger.get_claim_by_claim_id(accounts, claim_id)
txo = await self.ledger.get_claim_by_claim_id(accounts, claim_id, include_purchase_receipt=True)
if not isinstance(txo, Output) or not txo.is_claim:
raise Exception(f"Could not find claim with claim_id '{claim_id}'. ")
elif url:
txo = (await self.ledger.resolve(accounts, [url]))[url]
txo = (await self.ledger.resolve(accounts, [url], include_purchase_receipt=True))[url]
if not isinstance(txo, Output) or not txo.is_claim:
raise Exception(f"Could not find claim with url '{url}'. ")
else:

View file

@ -752,8 +752,8 @@ class Ledger(metaclass=LedgerRegistry):
include_is_my_output=include_is_my_output
)
async def get_claim_by_claim_id(self, accounts, claim_id) -> Output:
for claim in (await self.claim_search(accounts, claim_id=claim_id))[0]:
async def get_claim_by_claim_id(self, accounts, claim_id, **kwargs) -> Output:
for claim in (await self.claim_search(accounts, claim_id=claim_id, **kwargs))[0]:
return claim
async def _report_state(self):

View file

@ -147,7 +147,7 @@ class PurchaseCommandTests(CommandTestCase):
self.assertEqual(result[1]['claim_id'], result[1]['purchase_receipt']['claim_id'])
url = result[0]['canonical_url']
resolve = await self.resolve(url)
resolve = await self.resolve(url, include_purchase_receipt=True)
self.assertEqual(result[0]['claim_id'], resolve['purchase_receipt']['claim_id'])
self.assertItemCount(await self.daemon.jsonrpc_file_list(), 0)