diff options
author | Sebastian <sebasjm@gmail.com> | 2024-02-16 16:09:49 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2024-02-16 16:09:49 -0300 |
commit | 90c7dc49b7d377b4b3e691f45b84b51f6b03f9af (patch) | |
tree | 25778b155e7dba168eab981ca47d6d63cba94163 /packages/taler-wallet-core/src | |
parent | 366e1fb65fb33b7b17b61e2f90269b7fd4097fb4 (diff) | |
download | wallet-core-90c7dc49b7d377b4b3e691f45b84b51f6b03f9af.tar.xz |
fix #8415
Diffstat (limited to 'packages/taler-wallet-core/src')
-rw-r--r-- | packages/taler-wallet-core/src/db.ts | 29 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/operations/pay-merchant.ts | 14 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/remote.ts | 13 |
3 files changed, 32 insertions, 24 deletions
diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts index 3b53bbf35..0aae2ddff 100644 --- a/packages/taler-wallet-core/src/db.ts +++ b/packages/taler-wallet-core/src/db.ts @@ -1284,8 +1284,9 @@ export interface PurchaseRecord { posConfirmation: string | undefined; /** - * This purchase was created by sharing nonce or - * did the wallet made the nonce public + * This purchase was created by reading + * a payment share or the wallet + * the nonce public by a payment share */ shared: boolean; @@ -1337,9 +1338,9 @@ export enum ConfigRecordKey { */ export type ConfigRecord = | { - key: ConfigRecordKey.WalletBackupState; - value: WalletBackupConfState; - } + key: ConfigRecordKey.WalletBackupState; + value: WalletBackupConfState; + } | { key: ConfigRecordKey.CurrencyDefaultsApplied; value: boolean } | { key: ConfigRecordKey.DevMode; value: boolean } | { key: ConfigRecordKey.TestLoopTx; value: number }; @@ -1617,15 +1618,15 @@ export enum BackupProviderStateTag { export type BackupProviderState = | { - tag: BackupProviderStateTag.Provisional; - } + tag: BackupProviderStateTag.Provisional; + } | { - tag: BackupProviderStateTag.Ready; - nextBackupTimestamp: DbPreciseTimestamp; - } + tag: BackupProviderStateTag.Ready; + nextBackupTimestamp: DbPreciseTimestamp; + } | { - tag: BackupProviderStateTag.Retrying; - }; + tag: BackupProviderStateTag.Retrying; + }; export interface BackupProviderTerms { supportedProtocolVersion: string; @@ -3155,7 +3156,7 @@ export async function openStoredBackupsDatabase( idbFactory, TALER_WALLET_STORED_BACKUPS_DB_NAME, 1, - () => {}, + () => { }, onStoredBackupsDbUpgradeNeeded, ); @@ -3178,7 +3179,7 @@ export async function openTalerDatabase( idbFactory, TALER_WALLET_META_DB_NAME, 1, - () => {}, + () => { }, onMetaDbUpgradeNeeded, ); diff --git a/packages/taler-wallet-core/src/operations/pay-merchant.ts b/packages/taler-wallet-core/src/operations/pay-merchant.ts index 4b692fe69..63bef3add 100644 --- a/packages/taler-wallet-core/src/operations/pay-merchant.ts +++ b/packages/taler-wallet-core/src/operations/pay-merchant.ts @@ -640,8 +640,7 @@ async function processDownloadProposal( if (proposal.purchaseStatus != PurchaseStatus.PendingDownloadingProposal) { logger.error( - `unexpected state ${proposal.purchaseStatus}/${ - PurchaseStatus[proposal.purchaseStatus] + `unexpected state ${proposal.purchaseStatus}/${PurchaseStatus[proposal.purchaseStatus] } for ${ctx.transactionId} in processDownloadProposal`, ); return TaskRunResult.finished(); @@ -900,8 +899,7 @@ async function createOrReusePurchase( oldProposal.claimToken === claimToken ) { logger.info( - `Found old proposal (status=${ - PurchaseStatus[oldProposal.purchaseStatus] + `Found old proposal (status=${PurchaseStatus[oldProposal.purchaseStatus] }) for order ${orderId} at ${merchantBaseUrl}`, ); if (oldProposal.purchaseStatus === PurchaseStatus.DialogShared) { @@ -1721,6 +1719,14 @@ async function internalWaitPaymentResult( }; } + if (txRes.purchase.purchaseStatus > PurchaseStatus.Done) { + return { + type: ConfirmPayResultType.Done, + contractTerms: d.contractTermsRaw, + transactionId: ctx.transactionId, + }; + } + await purchaseNotifFlag.wait(); purchaseNotifFlag.reset(); } diff --git a/packages/taler-wallet-core/src/remote.ts b/packages/taler-wallet-core/src/remote.ts index 1ee0e1993..030b7a943 100644 --- a/packages/taler-wallet-core/src/remote.ts +++ b/packages/taler-wallet-core/src/remote.ts @@ -45,6 +45,7 @@ export interface RemoteWallet { } export interface RemoteWalletConnectArgs { + name?: string; socketFilename: string; notificationHandler?: (n: WalletNotification) => void; } @@ -86,14 +87,14 @@ export async function createRemoteWallet( return { result: ctx, onDisconnect() { - logger.info("remote wallet disconnected"); + logger.info(`${args.name}: remote wallet disconnected`); }, onMessage(m) { // FIXME: use a codec for parsing the response envelope! - logger.info(`got message from remote wallet: ${j2s(m)}`); + logger.info(`${args.name}: got message from remote: ${j2s(m)}`); if (typeof m !== "object" || m == null) { - logger.warn("message from wallet not understood (wrong type)"); + logger.warn(`${args.name}: message not understood (wrong type)`); return; } const type = (m as any).type; @@ -101,13 +102,13 @@ export async function createRemoteWallet( const id = (m as any).id; if (typeof id !== "string") { logger.warn( - "message from wallet not understood (no id in response)", + `${args.name}: message not understood (no id in response)`, ); return; } const h = requestMap.get(id); if (!h) { - logger.warn(`no handler registered for response id ${id}`); + logger.warn(`${args.name}: no handler registered for response id ${id}`); return; } h.promiseCapability.resolve(m as any); @@ -116,7 +117,7 @@ export async function createRemoteWallet( args.notificationHandler((m as any).payload); } } else { - logger.warn("message from wallet not understood"); + logger.warn(`${args.name}: message not understood`); } }, }; |