add delivery info in the parse contract terms and a function to get info from a proposalId
This commit is contained in:
parent
88bdcae030
commit
4409d8384b
@ -43,6 +43,7 @@ import {
|
|||||||
AgeCommitmentProof,
|
AgeCommitmentProof,
|
||||||
PayCoinSelection,
|
PayCoinSelection,
|
||||||
PeerContractTerms,
|
PeerContractTerms,
|
||||||
|
Location,
|
||||||
} from "@gnu-taler/taler-util";
|
} from "@gnu-taler/taler-util";
|
||||||
import { RetryInfo } from "./util/retries.js";
|
import { RetryInfo } from "./util/retries.js";
|
||||||
import { Event, IDBDatabase } from "@gnu-taler/idb-bridge";
|
import { Event, IDBDatabase } from "@gnu-taler/idb-bridge";
|
||||||
@ -1170,6 +1171,8 @@ export interface WalletContractData {
|
|||||||
wireInfoHash: string;
|
wireInfoHash: string;
|
||||||
maxDepositFee: AmountJson;
|
maxDepositFee: AmountJson;
|
||||||
minimumAge?: number;
|
minimumAge?: number;
|
||||||
|
deliveryDate: TalerProtocolTimestamp | undefined;
|
||||||
|
deliveryLocation: Location | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum AbortStatus {
|
export enum AbortStatus {
|
||||||
|
@ -600,6 +600,8 @@ export async function importBackup(
|
|||||||
merchant: parsedContractTerms.merchant,
|
merchant: parsedContractTerms.merchant,
|
||||||
products: parsedContractTerms.products,
|
products: parsedContractTerms.products,
|
||||||
summaryI18n: parsedContractTerms.summary_i18n,
|
summaryI18n: parsedContractTerms.summary_i18n,
|
||||||
|
deliveryDate: parsedContractTerms.delivery_date,
|
||||||
|
deliveryLocation: parsedContractTerms.delivery_location,
|
||||||
},
|
},
|
||||||
contractTermsRaw: backupProposal.contract_terms_raw,
|
contractTermsRaw: backupProposal.contract_terms_raw,
|
||||||
};
|
};
|
||||||
@ -740,6 +742,8 @@ export async function importBackup(
|
|||||||
merchant: parsedContractTerms.merchant,
|
merchant: parsedContractTerms.merchant,
|
||||||
products: parsedContractTerms.products,
|
products: parsedContractTerms.products,
|
||||||
summaryI18n: parsedContractTerms.summary_i18n,
|
summaryI18n: parsedContractTerms.summary_i18n,
|
||||||
|
deliveryDate: parsedContractTerms.delivery_date,
|
||||||
|
deliveryLocation: parsedContractTerms.delivery_location,
|
||||||
},
|
},
|
||||||
contractTermsRaw: backupPurchase.contract_terms_raw,
|
contractTermsRaw: backupPurchase.contract_terms_raw,
|
||||||
};
|
};
|
||||||
|
@ -662,6 +662,8 @@ export function extractContractData(
|
|||||||
products: parsedContractTerms.products,
|
products: parsedContractTerms.products,
|
||||||
summaryI18n: parsedContractTerms.summary_i18n,
|
summaryI18n: parsedContractTerms.summary_i18n,
|
||||||
minimumAge: parsedContractTerms.minimum_age,
|
minimumAge: parsedContractTerms.minimum_age,
|
||||||
|
deliveryDate: parsedContractTerms.delivery_date,
|
||||||
|
deliveryLocation: parsedContractTerms.delivery_location,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1318,6 +1320,27 @@ export async function checkPaymentByProposalId(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getContractTermsDetails(
|
||||||
|
ws: InternalWalletState,
|
||||||
|
proposalId: string,
|
||||||
|
): Promise<WalletContractData> {
|
||||||
|
const proposal = await ws.db
|
||||||
|
.mktx((x) => ({ proposals: x.proposals }))
|
||||||
|
.runReadOnly(async (tx) => {
|
||||||
|
return tx.proposals.get(proposalId);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!proposal) {
|
||||||
|
throw Error(`proposal with id ${proposalId} not found`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!proposal.download || !proposal.download.contractData) {
|
||||||
|
throw Error("proposal is in invalid state");
|
||||||
|
}
|
||||||
|
|
||||||
|
return proposal.download.contractData
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a payment for the given taler://pay/ URI is possible.
|
* Check if a payment for the given taler://pay/ URI is possible.
|
||||||
*
|
*
|
||||||
|
@ -448,6 +448,9 @@ export async function getTransactions(
|
|||||||
tipRecord.walletTipId,
|
tipRecord.walletTipId,
|
||||||
),
|
),
|
||||||
merchantBaseUrl: tipRecord.merchantBaseUrl,
|
merchantBaseUrl: tipRecord.merchantBaseUrl,
|
||||||
|
// merchant: {
|
||||||
|
// name: tipRecord.merchantBaseUrl,
|
||||||
|
// },
|
||||||
error: tipRecord.lastError,
|
error: tipRecord.lastError,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -43,6 +43,7 @@ import {
|
|||||||
codecForCreateDepositGroupRequest,
|
codecForCreateDepositGroupRequest,
|
||||||
codecForDeleteTransactionRequest,
|
codecForDeleteTransactionRequest,
|
||||||
codecForForceRefreshRequest,
|
codecForForceRefreshRequest,
|
||||||
|
codecForGetContractTermsDetails,
|
||||||
codecForGetExchangeTosRequest,
|
codecForGetExchangeTosRequest,
|
||||||
codecForGetExchangeWithdrawalInfo,
|
codecForGetExchangeWithdrawalInfo,
|
||||||
codecForGetFeeForDeposit,
|
codecForGetFeeForDeposit,
|
||||||
@ -142,6 +143,7 @@ import {
|
|||||||
import { getMerchantInfo } from "./operations/merchants.js";
|
import { getMerchantInfo } from "./operations/merchants.js";
|
||||||
import {
|
import {
|
||||||
confirmPay,
|
confirmPay,
|
||||||
|
getContractTermsDetails,
|
||||||
preparePayForUri,
|
preparePayForUri,
|
||||||
processDownloadProposal,
|
processDownloadProposal,
|
||||||
processPurchasePay,
|
processPurchasePay,
|
||||||
@ -868,6 +870,10 @@ async function dispatchRequestInternal(
|
|||||||
const req = codecForGetExchangeTosRequest().decode(payload);
|
const req = codecForGetExchangeTosRequest().decode(payload);
|
||||||
return getExchangeTos(ws, req.exchangeBaseUrl, req.acceptedFormat);
|
return getExchangeTos(ws, req.exchangeBaseUrl, req.acceptedFormat);
|
||||||
}
|
}
|
||||||
|
case "getContractTermsDetails": {
|
||||||
|
const req = codecForGetContractTermsDetails().decode(payload);
|
||||||
|
return getContractTermsDetails(ws, req.proposalId);
|
||||||
|
}
|
||||||
case "retryPendingNow": {
|
case "retryPendingNow": {
|
||||||
await runPending(ws, true);
|
await runPending(ws, true);
|
||||||
return {};
|
return {};
|
||||||
|
Loading…
Reference in New Issue
Block a user