#7741 share payment
add shared flag in db new state purchase dialogShared new error WALLET_ORDER_ALREADY_PAID removing nonce from normal operation new operation: sharePayment which returns payUri with nonce
This commit is contained in:
parent
15a15942d2
commit
f47b5bd783
@ -63,7 +63,11 @@
|
|||||||
* Imports.
|
* Imports.
|
||||||
*/
|
*/
|
||||||
import { DenominationPubKey, UnblindedSignature } from "./taler-types.js";
|
import { DenominationPubKey, UnblindedSignature } from "./taler-types.js";
|
||||||
import { TalerProtocolDuration, TalerProtocolTimestamp, TalerPreciseTimestamp } from "./time.js";
|
import {
|
||||||
|
TalerProtocolDuration,
|
||||||
|
TalerProtocolTimestamp,
|
||||||
|
TalerPreciseTimestamp,
|
||||||
|
} from "./time.js";
|
||||||
|
|
||||||
export const BACKUP_TAG = "gnu-taler-wallet-backup-content" as const;
|
export const BACKUP_TAG = "gnu-taler-wallet-backup-content" as const;
|
||||||
/**
|
/**
|
||||||
@ -970,6 +974,8 @@ export interface BackupPurchase {
|
|||||||
* Continue querying the refund status until this deadline has expired.
|
* Continue querying the refund status until this deadline has expired.
|
||||||
*/
|
*/
|
||||||
auto_refund_deadline: TalerProtocolTimestamp | undefined;
|
auto_refund_deadline: TalerProtocolTimestamp | undefined;
|
||||||
|
|
||||||
|
shared: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1268,6 +1274,11 @@ export enum BackupProposalStatus {
|
|||||||
* but the user needs to accept/reject it.
|
* but the user needs to accept/reject it.
|
||||||
*/
|
*/
|
||||||
Proposed = "proposed",
|
Proposed = "proposed",
|
||||||
|
/**
|
||||||
|
* Proposed, other wallet may also have
|
||||||
|
* the purchase
|
||||||
|
*/
|
||||||
|
Shared = "shared",
|
||||||
/**
|
/**
|
||||||
* The user has rejected the proposal.
|
* The user has rejected the proposal.
|
||||||
*/
|
*/
|
||||||
|
@ -52,6 +52,9 @@ export interface DetailsMap {
|
|||||||
orderId: string;
|
orderId: string;
|
||||||
claimUrl: string;
|
claimUrl: string;
|
||||||
};
|
};
|
||||||
|
[TalerErrorCode.WALLET_ORDER_ALREADY_PAID]: {
|
||||||
|
orderId: string;
|
||||||
|
};
|
||||||
[TalerErrorCode.WALLET_CONTRACT_TERMS_MALFORMED]: empty;
|
[TalerErrorCode.WALLET_CONTRACT_TERMS_MALFORMED]: empty;
|
||||||
[TalerErrorCode.WALLET_CONTRACT_TERMS_SIGNATURE_INVALID]: {
|
[TalerErrorCode.WALLET_CONTRACT_TERMS_SIGNATURE_INVALID]: {
|
||||||
merchantPub: string;
|
merchantPub: string;
|
||||||
@ -98,7 +101,7 @@ export interface DetailsMap {
|
|||||||
};
|
};
|
||||||
[TalerErrorCode.WALLET_EXCHANGE_COIN_SIGNATURE_INVALID]: empty;
|
[TalerErrorCode.WALLET_EXCHANGE_COIN_SIGNATURE_INVALID]: empty;
|
||||||
[TalerErrorCode.WALLET_WITHDRAWAL_GROUP_INCOMPLETE]: {
|
[TalerErrorCode.WALLET_WITHDRAWAL_GROUP_INCOMPLETE]: {
|
||||||
numErrors: number,
|
numErrors: number;
|
||||||
errorsPerCoin: Record<number, TalerErrorDetail>;
|
errorsPerCoin: Record<number, TalerErrorDetail>;
|
||||||
};
|
};
|
||||||
[TalerErrorCode.WALLET_CORE_NOT_AVAILABLE]: empty;
|
[TalerErrorCode.WALLET_CORE_NOT_AVAILABLE]: empty;
|
||||||
@ -133,7 +136,7 @@ export interface DetailsMap {
|
|||||||
[TalerErrorCode.WALLET_EXCHANGE_BASE_URL_MISMATCH]: {
|
[TalerErrorCode.WALLET_EXCHANGE_BASE_URL_MISMATCH]: {
|
||||||
urlWallet: string;
|
urlWallet: string;
|
||||||
urlExchange: string;
|
urlExchange: string;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
type ErrBody<Y> = Y extends keyof DetailsMap ? DetailsMap[Y] : empty;
|
type ErrBody<Y> = Y extends keyof DetailsMap ? DetailsMap[Y] : empty;
|
||||||
|
@ -776,6 +776,14 @@ export enum TalerErrorCode {
|
|||||||
EXCHANGE_AGE_WITHDRAW_REVEAL_INVALID_HASH = 1164,
|
EXCHANGE_AGE_WITHDRAW_REVEAL_INVALID_HASH = 1164,
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The maximum age in the commitment is too large for the reserve
|
||||||
|
* Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).
|
||||||
|
* (A value of 0 indicates that the error is generated client-side).
|
||||||
|
*/
|
||||||
|
EXCHANGE_AGE_WITHDRAW_MAXIMUM_AGE_TOO_LARGE = 1165,
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The batch withdraw included a planchet that was already withdrawn. This is not allowed.
|
* The batch withdraw included a planchet that was already withdrawn. This is not allowed.
|
||||||
* Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).
|
* Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).
|
||||||
@ -1328,6 +1336,14 @@ export enum TalerErrorCode {
|
|||||||
EXCHANGE_PURSE_DELETE_SIGNATURE_INVALID = 1680,
|
EXCHANGE_PURSE_DELETE_SIGNATURE_INVALID = 1680,
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Withdrawal from the reserve requires age restriction to be set.
|
||||||
|
* Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).
|
||||||
|
* (A value of 0 indicates that the error is generated client-side).
|
||||||
|
*/
|
||||||
|
EXCHANGE_RESERVES_AGE_RESTRICTION_REQUIRED = 1681,
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The exchange failed to talk to the process responsible for its private denomination keys or the helpers had no denominations (properly) configured.
|
* The exchange failed to talk to the process responsible for its private denomination keys or the helpers had no denominations (properly) configured.
|
||||||
* Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).
|
* Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).
|
||||||
@ -3568,6 +3584,14 @@ export enum TalerErrorCode {
|
|||||||
WALLET_EXCHANGE_BASE_URL_MISMATCH = 7030,
|
WALLET_EXCHANGE_BASE_URL_MISMATCH = 7030,
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The order has already been paid by another wallet.
|
||||||
|
* Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).
|
||||||
|
* (A value of 0 indicates that the error is generated client-side).
|
||||||
|
*/
|
||||||
|
WALLET_ORDER_ALREADY_PAID = 7031,
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We encountered a timeout with our payment backend.
|
* We encountered a timeout with our payment backend.
|
||||||
* Returned with an HTTP status code of #MHD_HTTP_GATEWAY_TIMEOUT (504).
|
* Returned with an HTTP status code of #MHD_HTTP_GATEWAY_TIMEOUT (504).
|
||||||
|
@ -684,7 +684,6 @@ export const codecForPreparePayResultPaymentPossible =
|
|||||||
.property("proposalId", codecForString())
|
.property("proposalId", codecForString())
|
||||||
.property("contractTermsHash", codecForString())
|
.property("contractTermsHash", codecForString())
|
||||||
.property("talerUri", codecForString())
|
.property("talerUri", codecForString())
|
||||||
.property("noncePriv", codecForString())
|
|
||||||
.property(
|
.property(
|
||||||
"status",
|
"status",
|
||||||
codecForConstString(PreparePayResultType.PaymentPossible),
|
codecForConstString(PreparePayResultType.PaymentPossible),
|
||||||
@ -757,7 +756,6 @@ export const codecForPreparePayResultInsufficientBalance =
|
|||||||
.property("talerUri", codecForString())
|
.property("talerUri", codecForString())
|
||||||
.property("proposalId", codecForString())
|
.property("proposalId", codecForString())
|
||||||
.property("transactionId", codecForTransactionIdStr())
|
.property("transactionId", codecForTransactionIdStr())
|
||||||
.property("noncePriv", codecForString())
|
|
||||||
.property(
|
.property(
|
||||||
"status",
|
"status",
|
||||||
codecForConstString(PreparePayResultType.InsufficientBalance),
|
codecForConstString(PreparePayResultType.InsufficientBalance),
|
||||||
@ -775,7 +773,7 @@ export const codecForPreparePayResultAlreadyConfirmed =
|
|||||||
"status",
|
"status",
|
||||||
codecForConstString(PreparePayResultType.AlreadyConfirmed),
|
codecForConstString(PreparePayResultType.AlreadyConfirmed),
|
||||||
)
|
)
|
||||||
.property("amountEffective", codecForAmountString())
|
.property("amountEffective", codecOptional(codecForAmountString()))
|
||||||
.property("amountRaw", codecForAmountString())
|
.property("amountRaw", codecForAmountString())
|
||||||
.property("paid", codecForBoolean())
|
.property("paid", codecForBoolean())
|
||||||
.property("talerUri", codecOptional(codecForString()))
|
.property("talerUri", codecOptional(codecForString()))
|
||||||
@ -824,7 +822,6 @@ export interface PreparePayResultPaymentPossible {
|
|||||||
contractTermsHash: string;
|
contractTermsHash: string;
|
||||||
amountRaw: string;
|
amountRaw: string;
|
||||||
amountEffective: string;
|
amountEffective: string;
|
||||||
noncePriv: string;
|
|
||||||
talerUri: string;
|
talerUri: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -834,7 +831,6 @@ export interface PreparePayResultInsufficientBalance {
|
|||||||
proposalId: string;
|
proposalId: string;
|
||||||
contractTerms: MerchantContractTerms;
|
contractTerms: MerchantContractTerms;
|
||||||
amountRaw: string;
|
amountRaw: string;
|
||||||
noncePriv: string;
|
|
||||||
talerUri: string;
|
talerUri: string;
|
||||||
balanceDetails: PayMerchantInsufficientBalanceDetails;
|
balanceDetails: PayMerchantInsufficientBalanceDetails;
|
||||||
}
|
}
|
||||||
@ -845,7 +841,7 @@ export interface PreparePayResultAlreadyConfirmed {
|
|||||||
contractTerms: MerchantContractTerms;
|
contractTerms: MerchantContractTerms;
|
||||||
paid: boolean;
|
paid: boolean;
|
||||||
amountRaw: string;
|
amountRaw: string;
|
||||||
amountEffective: string;
|
amountEffective: string | undefined;
|
||||||
contractTermsHash: string;
|
contractTermsHash: string;
|
||||||
proposalId: string;
|
proposalId: string;
|
||||||
talerUri?: string;
|
talerUri?: string;
|
||||||
@ -1724,6 +1720,24 @@ export const codecForPreparePayRequest = (): Codec<PreparePayRequest> =>
|
|||||||
.property("talerPayUri", codecForString())
|
.property("talerPayUri", codecForString())
|
||||||
.build("PreparePay");
|
.build("PreparePay");
|
||||||
|
|
||||||
|
export interface SharePaymentRequest {
|
||||||
|
merchantBaseUrl: string;
|
||||||
|
orderId: string;
|
||||||
|
}
|
||||||
|
export const codecForSharePaymentRequest = (): Codec<SharePaymentRequest> =>
|
||||||
|
buildCodecForObject<SharePaymentRequest>()
|
||||||
|
.property("merchantBaseUrl", codecForString())
|
||||||
|
.property("orderId", codecForString())
|
||||||
|
.build("SharePaymentRequest");
|
||||||
|
|
||||||
|
export interface SharePaymentResult {
|
||||||
|
privatePayUri: string;
|
||||||
|
}
|
||||||
|
export const codecForSharePaymentResult = (): Codec<SharePaymentResult> =>
|
||||||
|
buildCodecForObject<SharePaymentResult>()
|
||||||
|
.property("privatePayUri", codecForString())
|
||||||
|
.build("SharePaymentResult");
|
||||||
|
|
||||||
export interface PreparePayTemplateRequest {
|
export interface PreparePayTemplateRequest {
|
||||||
talerPayTemplateUri: string;
|
talerPayTemplateUri: string;
|
||||||
templateParams: Record<string, string>;
|
templateParams: Record<string, string>;
|
||||||
|
Loading…
Reference in New Issue
Block a user