wallet-core: fix creation of refresh session after peer-{push,pull}
This commit is contained in:
parent
58211515d2
commit
b645d793df
@ -523,7 +523,9 @@ export interface PlanchetCreationRequest {
|
|||||||
*/
|
*/
|
||||||
export enum RefreshReason {
|
export enum RefreshReason {
|
||||||
Manual = "manual",
|
Manual = "manual",
|
||||||
Pay = "pay",
|
PayMerchant = "pay-merchant",
|
||||||
|
PayPeerPush = "pay-peer-push",
|
||||||
|
PayPeerPull = "pay-peer-pull",
|
||||||
Refund = "refund",
|
Refund = "refund",
|
||||||
AbortPay = "abort-pay",
|
AbortPay = "abort-pay",
|
||||||
Recoup = "recoup",
|
Recoup = "recoup",
|
||||||
|
@ -810,7 +810,7 @@ export async function importBackup(
|
|||||||
reason = RefreshReason.Manual;
|
reason = RefreshReason.Manual;
|
||||||
break;
|
break;
|
||||||
case BackupRefreshReason.Pay:
|
case BackupRefreshReason.Pay:
|
||||||
reason = RefreshReason.Pay;
|
reason = RefreshReason.PayMerchant;
|
||||||
break;
|
break;
|
||||||
case BackupRefreshReason.Recoup:
|
case BackupRefreshReason.Recoup:
|
||||||
reason = RefreshReason.Recoup;
|
reason = RefreshReason.Recoup;
|
||||||
|
@ -409,7 +409,7 @@ export async function applyCoinSpend(
|
|||||||
const refreshCoinPubs = coinSelection.coinPubs.map((x) => ({
|
const refreshCoinPubs = coinSelection.coinPubs.map((x) => ({
|
||||||
coinPub: x,
|
coinPub: x,
|
||||||
}));
|
}));
|
||||||
await createRefreshGroup(ws, tx, refreshCoinPubs, RefreshReason.Pay);
|
await createRefreshGroup(ws, tx, refreshCoinPubs, RefreshReason.PayMerchant);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -214,7 +214,6 @@ export async function initiatePeerToPeerPush(
|
|||||||
ws: InternalWalletState,
|
ws: InternalWalletState,
|
||||||
req: InitiatePeerPushPaymentRequest,
|
req: InitiatePeerPushPaymentRequest,
|
||||||
): Promise<InitiatePeerPushPaymentResponse> {
|
): Promise<InitiatePeerPushPaymentResponse> {
|
||||||
// FIXME: actually create a record for retries here!
|
|
||||||
const instructedAmount = Amounts.parseOrThrow(req.amount);
|
const instructedAmount = Amounts.parseOrThrow(req.amount);
|
||||||
|
|
||||||
const pursePair = await ws.cryptoApi.createEddsaKeypair({});
|
const pursePair = await ws.cryptoApi.createEddsaKeypair({});
|
||||||
@ -265,6 +264,7 @@ export async function initiatePeerToPeerPush(
|
|||||||
Amounts.parseOrThrow(c.contribution),
|
Amounts.parseOrThrow(c.contribution),
|
||||||
).amount;
|
).amount;
|
||||||
coin.status = CoinStatus.Dormant;
|
coin.status = CoinStatus.Dormant;
|
||||||
|
pubs.push({ coinPub: coin.coinPub });
|
||||||
await tx.coins.put(coin);
|
await tx.coins.put(coin);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,7 +283,7 @@ export async function initiatePeerToPeerPush(
|
|||||||
timestampCreated: TalerProtocolTimestamp.now(),
|
timestampCreated: TalerProtocolTimestamp.now(),
|
||||||
});
|
});
|
||||||
|
|
||||||
await createRefreshGroup(ws, tx, pubs, RefreshReason.Pay);
|
await createRefreshGroup(ws, tx, pubs, RefreshReason.PayPeerPush);
|
||||||
|
|
||||||
return sel;
|
return sel;
|
||||||
});
|
});
|
||||||
@ -601,10 +601,11 @@ export async function acceptPeerPullPayment(
|
|||||||
Amounts.parseOrThrow(c.contribution),
|
Amounts.parseOrThrow(c.contribution),
|
||||||
).amount;
|
).amount;
|
||||||
coin.status = CoinStatus.Dormant;
|
coin.status = CoinStatus.Dormant;
|
||||||
|
pubs.push({ coinPub: coin.coinPub });
|
||||||
await tx.coins.put(coin);
|
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(
|
const pi = await tx.peerPullPaymentIncoming.get(
|
||||||
req.peerPullPaymentIncomingId,
|
req.peerPullPaymentIncomingId,
|
||||||
@ -711,6 +712,9 @@ export async function checkPeerPullPayment(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initiate a peer pull payment.
|
||||||
|
*/
|
||||||
export async function initiatePeerRequestForPay(
|
export async function initiatePeerRequestForPay(
|
||||||
ws: InternalWalletState,
|
ws: InternalWalletState,
|
||||||
req: InitiatePeerPullPaymentRequest,
|
req: InitiatePeerPullPaymentRequest,
|
||||||
|
Loading…
Reference in New Issue
Block a user