diff options
-rw-r--r-- | packages/taler-util/src/backup-types.ts | 5 | ||||
-rw-r--r-- | packages/taler-util/src/taler-types.ts | 2 | ||||
-rw-r--r-- | packages/taler-util/src/transactions-types.ts | 5 | ||||
-rw-r--r-- | packages/taler-util/src/wallet-types.ts | 8 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/db.ts | 2 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/operations/backup/export.ts | 1 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/operations/backup/import.ts | 1 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/operations/pay-merchant.ts | 9 | ||||
-rw-r--r-- | packages/taler-wallet-core/src/operations/transactions.ts | 1 |
9 files changed, 27 insertions, 7 deletions
diff --git a/packages/taler-util/src/backup-types.ts b/packages/taler-util/src/backup-types.ts index 0a355b65f..f7bf5ef30 100644 --- a/packages/taler-util/src/backup-types.ts +++ b/packages/taler-util/src/backup-types.ts @@ -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; /** diff --git a/packages/taler-util/src/taler-types.ts b/packages/taler-util/src/taler-types.ts index 6e7df2c04..48eb49d22 100644 --- a/packages/taler-util/src/taler-types.ts +++ b/packages/taler-util/src/taler-types.ts @@ -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> => diff --git a/packages/taler-util/src/transactions-types.ts b/packages/taler-util/src/transactions-types.ts index d3b68b114..eec173de6 100644 --- a/packages/taler-util/src/transactions-types.ts +++ b/packages/taler-util/src/transactions-types.ts @@ -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 { diff --git a/packages/taler-util/src/wallet-types.ts b/packages/taler-util/src/wallet-types.ts index de84677ac..940251366 100644 --- a/packages/taler-util/src/wallet-types.ts +++ b/packages/taler-util/src/wallet-types.ts @@ -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, diff --git a/packages/taler-wallet-core/src/db.ts b/packages/taler-wallet-core/src/db.ts index 9ee157a2a..0ec2e31c8 100644 --- a/packages/taler-wallet-core/src/db.ts +++ b/packages/taler-wallet-core/src/db.ts @@ -1239,6 +1239,8 @@ export interface PurchaseRecord { merchantPaySig: string | undefined; + posConfirmation: string | undefined; + /** * When was the purchase record created? */ diff --git a/packages/taler-wallet-core/src/operations/backup/export.ts b/packages/taler-wallet-core/src/operations/backup/export.ts index 3dd4e0e32..68f8beb93 100644 --- a/packages/taler-wallet-core/src/operations/backup/export.ts +++ b/packages/taler-wallet-core/src/operations/backup/export.ts @@ -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, diff --git a/packages/taler-wallet-core/src/operations/backup/import.ts b/packages/taler-wallet-core/src/operations/backup/import.ts index c1be1d4d9..32b90e126 100644 --- a/packages/taler-wallet-core/src/operations/backup/import.ts +++ b/packages/taler-wallet-core/src/operations/backup/import.ts @@ -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, diff --git a/packages/taler-wallet-core/src/operations/pay-merchant.ts b/packages/taler-wallet-core/src/operations/pay-merchant.ts index f8fa1d34d..496641fe7 100644 --- a/packages/taler-wallet-core/src/operations/pay-merchant.ts +++ b/packages/taler-wallet-core/src/operations/pay-merchant.ts @@ -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( diff --git a/packages/taler-wallet-core/src/operations/transactions.ts b/packages/taler-wallet-core/src/operations/transactions.ts index c0045aced..34d76c5c2 100644 --- a/packages/taler-wallet-core/src/operations/transactions.ts +++ b/packages/taler-wallet-core/src/operations/transactions.ts @@ -1014,6 +1014,7 @@ async function buildTransactionForPurchase( extendedStatus: status, pending: purchaseRecord.purchaseStatus === PurchaseStatus.Paying, refunds, + posConfirmation: purchaseRecord.posConfirmation, timestamp, transactionId: makeTransactionId( TransactionType.Payment, |