save posConfirmation after payment
This commit is contained in:
parent
defdfd7697
commit
543795f7fc
@ -947,6 +947,11 @@ export interface BackupPurchase {
|
||||
*/
|
||||
merchant_pay_sig: string | undefined;
|
||||
|
||||
/**
|
||||
* Text to be shown to the point-of-sale staff as a proof of payment.
|
||||
*/
|
||||
pos_confirmation: string | undefined;
|
||||
|
||||
timestamp_proposed: TalerProtocolTimestamp;
|
||||
|
||||
/**
|
||||
|
@ -961,6 +961,7 @@ export class ExchangeWithdrawBatchResponse {
|
||||
|
||||
export interface MerchantPayResponse {
|
||||
sig: string;
|
||||
pos_confirmation?: string;
|
||||
}
|
||||
|
||||
export interface ExchangeMeltRequest {
|
||||
@ -1490,6 +1491,7 @@ export const codecForWithdrawBatchResponse =
|
||||
export const codecForMerchantPayResponse = (): Codec<MerchantPayResponse> =>
|
||||
buildCodecForObject<MerchantPayResponse>()
|
||||
.property("sig", codecForString())
|
||||
.property("pos_confirmation", codecOptional(codecForString()))
|
||||
.build("MerchantPayResponse");
|
||||
|
||||
export const codecForExchangeMeltResponse = (): Codec<ExchangeMeltResponse> =>
|
||||
|
@ -406,6 +406,11 @@ export interface TransactionPayment extends TransactionCommon {
|
||||
* Is the wallet currently checking for a refund?
|
||||
*/
|
||||
refundQueryActive: boolean;
|
||||
|
||||
/**
|
||||
* Does this purchase has an pos validation
|
||||
*/
|
||||
posConfirmation: string | undefined;
|
||||
}
|
||||
|
||||
export interface OrderShortInfo {
|
||||
|
@ -51,15 +51,15 @@ import {
|
||||
AmountString,
|
||||
AuditorDenomSig,
|
||||
codecForMerchantContractTerms,
|
||||
codecForPeerContractTerms,
|
||||
CoinEnvelope,
|
||||
MerchantContractTerms,
|
||||
PeerContractTerms,
|
||||
DenominationPubKey,
|
||||
DenomKeyType,
|
||||
ExchangeAuditor,
|
||||
UnblindedSignature,
|
||||
codecForPeerContractTerms,
|
||||
MerchantContractTerms,
|
||||
PeerContractTerms,
|
||||
TrackTransaction,
|
||||
UnblindedSignature,
|
||||
} from "./taler-types.js";
|
||||
import {
|
||||
AbsoluteTime,
|
||||
|
@ -1239,6 +1239,8 @@ export interface PurchaseRecord {
|
||||
|
||||
merchantPaySig: string | undefined;
|
||||
|
||||
posConfirmation: string | undefined;
|
||||
|
||||
/**
|
||||
* When was the purchase record created?
|
||||
*/
|
||||
|
@ -468,6 +468,7 @@ export async function exportBackup(
|
||||
contract_terms_raw: contractTermsRaw,
|
||||
auto_refund_deadline: purch.autoRefundDeadline,
|
||||
merchant_pay_sig: purch.merchantPaySig,
|
||||
pos_confirmation: purch.posConfirmation,
|
||||
pay_info: backupPayInfo,
|
||||
proposal_id: purch.proposalId,
|
||||
refunds,
|
||||
|
@ -691,6 +691,7 @@ export async function importBackup(
|
||||
backupPurchase.timestamp_first_successful_pay,
|
||||
timestampLastRefundStatus: undefined,
|
||||
merchantPaySig: backupPurchase.merchant_pay_sig,
|
||||
posConfirmation: backupPurchase.pos_confirmation,
|
||||
lastSessionId: undefined,
|
||||
download,
|
||||
refunds,
|
||||
|
@ -57,6 +57,7 @@ import {
|
||||
MerchantCoinRefundStatus,
|
||||
MerchantCoinRefundSuccessStatus,
|
||||
MerchantContractTerms,
|
||||
MerchantPayResponse,
|
||||
NotificationType,
|
||||
parsePayUri,
|
||||
parseRefundUri,
|
||||
@ -605,6 +606,7 @@ async function startDownloadProposal(
|
||||
timestampFirstSuccessfulPay: undefined,
|
||||
timestampLastRefundStatus: undefined,
|
||||
pendingRemovedCoinPubs: undefined,
|
||||
posConfirmation: undefined,
|
||||
};
|
||||
|
||||
await ws.db
|
||||
@ -629,7 +631,7 @@ async function storeFirstPaySuccess(
|
||||
ws: InternalWalletState,
|
||||
proposalId: string,
|
||||
sessionId: string | undefined,
|
||||
paySig: string,
|
||||
payResponse: MerchantPayResponse,
|
||||
): Promise<void> {
|
||||
const now = AbsoluteTime.toTimestamp(AbsoluteTime.now());
|
||||
await ws.db
|
||||
@ -651,7 +653,8 @@ async function storeFirstPaySuccess(
|
||||
}
|
||||
purchase.timestampFirstSuccessfulPay = now;
|
||||
purchase.lastSessionId = sessionId;
|
||||
purchase.merchantPaySig = paySig;
|
||||
purchase.merchantPaySig = payResponse.sig;
|
||||
purchase.posConfirmation = payResponse.pos_confirmation;
|
||||
const dl = purchase.download;
|
||||
checkDbInvariant(!!dl);
|
||||
const contractTermsRecord = await tx.contractTerms.get(
|
||||
@ -1529,7 +1532,7 @@ export async function processPurchasePay(
|
||||
throw Error("merchant payment signature invalid");
|
||||
}
|
||||
|
||||
await storeFirstPaySuccess(ws, proposalId, sessionId, merchantResp.sig);
|
||||
await storeFirstPaySuccess(ws, proposalId, sessionId, merchantResp);
|
||||
await unblockBackup(ws, proposalId);
|
||||
} else {
|
||||
const payAgainUrl = new URL(
|
||||
|
@ -1014,6 +1014,7 @@ async function buildTransactionForPurchase(
|
||||
extendedStatus: status,
|
||||
pending: purchaseRecord.purchaseStatus === PurchaseStatus.Paying,
|
||||
refunds,
|
||||
posConfirmation: purchaseRecord.posConfirmation,
|
||||
timestamp,
|
||||
transactionId: makeTransactionId(
|
||||
TransactionType.Payment,
|
||||
|
Loading…
Reference in New Issue
Block a user