commit 7bb54bcc130b4ad4a7e4984d6a9f8a8508804498
parent 35ebcf2dcd7e70c9300f80515e2d083bac0fbee6
Author: Florian Dold <florian@dold.me>
Date: Wed, 28 May 2025 19:48:14 +0200
wallet-core: fix reporting of KYC access token in peer-push-credit
Diffstat:
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/packages/taler-harness/src/integrationtests/test-kyc-peer-push.ts b/packages/taler-harness/src/integrationtests/test-kyc-peer-push.ts
@@ -116,6 +116,7 @@ export async function runKycPeerPushTest(t: GlobalTestState) {
t.assertTrue(!!kycPaytoHash);
t.assertTrue(!!txDet.kycAccessToken);
+ t.assertTrue(!!txDet.kycUrl);
await postAmlDecisionNoRules(t, {
amlPriv: amlKeypair.priv,
diff --git a/packages/taler-wallet-core/src/pay-peer-push-credit.ts b/packages/taler-wallet-core/src/pay-peer-push-credit.ts
@@ -182,8 +182,18 @@ export class PeerPushCreditTransactionContext implements TransactionContext {
const peerContractTerms = ct.contractTermsRaw;
let kycUrl: string | undefined = undefined;
+ let kycAccessToken: string | undefined = undefined;
if (wg?.kycAccessToken && wg.exchangeBaseUrl) {
+ // This should not really happen, as the p2p merge
+ // should not count towards the withdrawal limit.
kycUrl = new URL(`kyc-spa/${wg.kycAccessToken}`, wg.exchangeBaseUrl).href;
+ kycAccessToken = wg.kycAccessToken;
+ } else if (pushInc.kycAccessToken) {
+ kycUrl = new URL(
+ `kyc-spa/${pushInc.kycAccessToken}`,
+ pushInc.exchangeBaseUrl,
+ ).href;
+ kycAccessToken = pushInc.kycAccessToken;
}
if (wg) {
@@ -237,6 +247,7 @@ export class PeerPushCreditTransactionContext implements TransactionContext {
},
kycUrl,
kycPaytoHash: pushInc.kycPaytoHash,
+ kycAccessToken,
timestamp: timestampPreciseFromDb(pushInc.timestamp),
transactionId: this.transactionId,
abortReason: pushInc.abortReason,
@@ -649,12 +660,15 @@ async function processPeerPushCreditKycRequired(
paytoHash: kycPending.h_payto,
});
+ logger.info(`kyc-check response case: ${resp.case}`);
+
switch (resp.case) {
case "ok":
case HttpStatusCode.Ok:
logger.warn("kyc requested, but already fulfilled");
return TaskRunResult.finished();
case HttpStatusCode.Accepted:
+ logger.info(`kyc-check response body: ${j2s(resp.body)}`);
const { transitionInfo, result } = await wex.db.runReadWriteTx(
{ storeNames: ["peerPushCredit", "transactionsMeta"] },
async (tx) => {