summaryrefslogtreecommitdiff
path: root/packages/taler-wallet-core/src
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2022-09-12 20:52:01 +0200
committerFlorian Dold <florian@dold.me>2022-09-12 20:52:01 +0200
commitb645d793df330d61c719e56acb96d7feebef4b21 (patch)
tree6fd4a80ae24b49711e29249cbb514e6b175854a3 /packages/taler-wallet-core/src
parent58211515d2de641db16ffba119d31a09ef9df08e (diff)
downloadwallet-core-b645d793df330d61c719e56acb96d7feebef4b21.tar.gz
wallet-core-b645d793df330d61c719e56acb96d7feebef4b21.tar.bz2
wallet-core-b645d793df330d61c719e56acb96d7feebef4b21.zip
wallet-core: fix creation of refresh session after peer-{push,pull}
Diffstat (limited to 'packages/taler-wallet-core/src')
-rw-r--r--packages/taler-wallet-core/src/operations/backup/import.ts2
-rw-r--r--packages/taler-wallet-core/src/operations/pay.ts2
-rw-r--r--packages/taler-wallet-core/src/operations/peer-to-peer.ts10
3 files changed, 9 insertions, 5 deletions
diff --git a/packages/taler-wallet-core/src/operations/backup/import.ts b/packages/taler-wallet-core/src/operations/backup/import.ts
index 57d7449e0..ff7ff0d03 100644
--- a/packages/taler-wallet-core/src/operations/backup/import.ts
+++ b/packages/taler-wallet-core/src/operations/backup/import.ts
@@ -810,7 +810,7 @@ export async function importBackup(
reason = RefreshReason.Manual;
break;
case BackupRefreshReason.Pay:
- reason = RefreshReason.Pay;
+ reason = RefreshReason.PayMerchant;
break;
case BackupRefreshReason.Recoup:
reason = RefreshReason.Recoup;
diff --git a/packages/taler-wallet-core/src/operations/pay.ts b/packages/taler-wallet-core/src/operations/pay.ts
index 8193bf86a..3d4d2b5a0 100644
--- a/packages/taler-wallet-core/src/operations/pay.ts
+++ b/packages/taler-wallet-core/src/operations/pay.ts
@@ -409,7 +409,7 @@ export async function applyCoinSpend(
const refreshCoinPubs = coinSelection.coinPubs.map((x) => ({
coinPub: x,
}));
- await createRefreshGroup(ws, tx, refreshCoinPubs, RefreshReason.Pay);
+ await createRefreshGroup(ws, tx, refreshCoinPubs, RefreshReason.PayMerchant);
}
/**
diff --git a/packages/taler-wallet-core/src/operations/peer-to-peer.ts b/packages/taler-wallet-core/src/operations/peer-to-peer.ts
index 965dfd8ed..9ce460ad6 100644
--- a/packages/taler-wallet-core/src/operations/peer-to-peer.ts
+++ b/packages/taler-wallet-core/src/operations/peer-to-peer.ts
@@ -214,7 +214,6 @@ export async function initiatePeerToPeerPush(
ws: InternalWalletState,
req: InitiatePeerPushPaymentRequest,
): Promise<InitiatePeerPushPaymentResponse> {
- // FIXME: actually create a record for retries here!
const instructedAmount = Amounts.parseOrThrow(req.amount);
const pursePair = await ws.cryptoApi.createEddsaKeypair({});
@@ -265,6 +264,7 @@ export async function initiatePeerToPeerPush(
Amounts.parseOrThrow(c.contribution),
).amount;
coin.status = CoinStatus.Dormant;
+ pubs.push({ coinPub: coin.coinPub });
await tx.coins.put(coin);
}
@@ -283,7 +283,7 @@ export async function initiatePeerToPeerPush(
timestampCreated: TalerProtocolTimestamp.now(),
});
- await createRefreshGroup(ws, tx, pubs, RefreshReason.Pay);
+ await createRefreshGroup(ws, tx, pubs, RefreshReason.PayPeerPush);
return sel;
});
@@ -601,10 +601,11 @@ export async function acceptPeerPullPayment(
Amounts.parseOrThrow(c.contribution),
).amount;
coin.status = CoinStatus.Dormant;
+ pubs.push({ coinPub: coin.coinPub });
await tx.coins.put(coin);
}
- await createRefreshGroup(ws, tx, pubs, RefreshReason.Pay);
+ await createRefreshGroup(ws, tx, pubs, RefreshReason.PayPeerPull);
const pi = await tx.peerPullPaymentIncoming.get(
req.peerPullPaymentIncomingId,
@@ -711,6 +712,9 @@ export async function checkPeerPullPayment(
};
}
+/**
+ * Initiate a peer pull payment.
+ */
export async function initiatePeerRequestForPay(
ws: InternalWalletState,
req: InitiatePeerPullPaymentRequest,