summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2023-12-13 08:28:06 +0100
committerFlorian Dold <florian@dold.me>2023-12-13 08:28:06 +0100
commitdd7cc6f886122eb5cec8428e2edf28ddb95aa520 (patch)
tree874ddb0630ed7dcc2af8e6a339561981ef792f29
parent00b98cb79d1a99d42fbbf6a09eada615b45e8bf6 (diff)
downloadwallet-core-dd7cc6f886122eb5cec8428e2edf28ddb95aa520.tar.gz
wallet-core-dd7cc6f886122eb5cec8428e2edf28ddb95aa520.tar.bz2
wallet-core-dd7cc6f886122eb5cec8428e2edf28ddb95aa520.zip
-comment
-rw-r--r--packages/taler-util/src/wallet-types.ts10
-rw-r--r--packages/taler-wallet-core/src/operations/pay-peer-push-credit.ts30
2 files changed, 30 insertions, 10 deletions
diff --git a/packages/taler-util/src/wallet-types.ts b/packages/taler-util/src/wallet-types.ts
index 409aa07a6..e9f61680c 100644
--- a/packages/taler-util/src/wallet-types.ts
+++ b/packages/taler-util/src/wallet-types.ts
@@ -1088,13 +1088,19 @@ export interface ExchangeDetailedResponse {
export interface WalletCoreVersion {
/**
- * @deprecated
+ * Wallet-core protocol version supported by this implementation
+ * of the API ("server" version).
*/
- hash: string | undefined;
version: string;
exchange: string;
merchant: string;
bank: string;
+
+ /**
+ * @deprecated
+ */
+ hash: string | undefined;
+
/**
* @deprecated will be removed
*/
diff --git a/packages/taler-wallet-core/src/operations/pay-peer-push-credit.ts b/packages/taler-wallet-core/src/operations/pay-peer-push-credit.ts
index 575780ba4..1174ccc8e 100644
--- a/packages/taler-wallet-core/src/operations/pay-peer-push-credit.ts
+++ b/packages/taler-wallet-core/src/operations/pay-peer-push-credit.ts
@@ -193,10 +193,10 @@ export async function preparePeerPushCredit(
undefined,
);
- await ws.db
+ const transitionInfo = await ws.db
.mktx((x) => [x.contractTerms, x.peerPushCredit])
.runReadWrite(async (tx) => {
- await tx.peerPushCredit.add({
+ const rec: PeerPushPaymentIncomingRecord = {
peerPushCreditId,
contractPriv: contractPriv,
exchangeBaseUrl: exchangeBaseUrl,
@@ -210,14 +210,30 @@ export async function preparePeerPushCredit(
estimatedAmountEffective: Amounts.stringify(
wi.withdrawalAmountEffective,
),
- });
-
+ };
+ await tx.peerPushCredit.add(rec);
await tx.contractTerms.put({
h: contractTermsHash,
contractTermsRaw: dec.contractTerms,
});
+
+ const newTxState = computePeerPushCreditTransactionState(rec);
+
+ return {
+ oldTxState: {
+ major: TransactionMajorState.None,
+ },
+ newTxState,
+ } satisfies TransitionInfo;
});
+ const transactionId = constructTransactionIdentifier({
+ tag: TransactionType.PeerPushCredit,
+ peerPushCreditId,
+ });
+
+ notifyTransition(ws, transactionId, transitionInfo);
+
ws.notify({ type: NotificationType.BalanceChange });
return {
@@ -226,10 +242,7 @@ export async function preparePeerPushCredit(
amountRaw: purseStatus.balance,
contractTerms: dec.contractTerms,
peerPushCreditId,
- transactionId: constructTransactionIdentifier({
- tag: TransactionType.PeerPushCredit,
- peerPushCreditId,
- }),
+ transactionId,
exchangeBaseUrl,
};
}
@@ -481,6 +494,7 @@ async function handlePendingMerge(
tx,
withdrawalGroupPrep,
);
+ withdrawalTransition = wgRes.transitionInfo;
peerInc.withdrawalGroupId = wgRes.withdrawalGroup.withdrawalGroupId;
break;
}