aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-util/src
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2023-04-05 17:38:34 +0200
committerFlorian Dold <florian@dold.me>2023-04-05 17:38:41 +0200
commit2823b1cdf4b6e9a6c4dbdb752c7c7259775e18f5 (patch)
tree9d6fe1e025f89cea0e044f8bba53f67e7d04a77f /packages/taler-util/src
parent8eee38d55936c194637ecead302dde69ec0b9897 (diff)
downloadwallet-core-2823b1cdf4b6e9a6c4dbdb752c7c7259775e18f5.tar.xz
wallet-core: towards DD37 for deposits
Diffstat (limited to 'packages/taler-util/src')
-rw-r--r--packages/taler-util/src/http-common.ts4
-rw-r--r--packages/taler-util/src/transactions-types.ts38
-rw-r--r--packages/taler-util/src/wallet-types.ts39
3 files changed, 47 insertions, 34 deletions
diff --git a/packages/taler-util/src/http-common.ts b/packages/taler-util/src/http-common.ts
index e5dd92567..1329c8a55 100644
--- a/packages/taler-util/src/http-common.ts
+++ b/packages/taler-util/src/http-common.ts
@@ -104,6 +104,8 @@ export interface HttpRequestLibrary {
* Make an HTTP GET request.
*
* FIXME: Get rid of this, we want the API surface to be minimal.
+ *
+ * @deprecated use fetch instead
*/
get(url: string, opt?: HttpRequestOptions): Promise<HttpResponse>;
@@ -111,6 +113,8 @@ export interface HttpRequestLibrary {
* Make an HTTP POST request with a JSON body.
*
* FIXME: Get rid of this, we want the API surface to be minimal.
+ *
+ * @deprecated use fetch instead
*/
postJson(
url: string,
diff --git a/packages/taler-util/src/transactions-types.ts b/packages/taler-util/src/transactions-types.ts
index eec173de6..474372c4f 100644
--- a/packages/taler-util/src/transactions-types.ts
+++ b/packages/taler-util/src/transactions-types.ts
@@ -59,6 +59,11 @@ export enum ExtendedStatus {
KycRequired = "kyc-required",
}
+export interface TransactionStateInfo {
+ txState: TransactionState;
+ txSubstate: TransactionSubstate;
+}
+
export interface TransactionsRequest {
/**
* return only transactions in the given currency
@@ -76,6 +81,32 @@ export interface TransactionsRequest {
includeRefreshes?: boolean;
}
+export enum TransactionState {
+ // No state, only used when reporting transitions into the initial state
+ None = "none",
+ Pending = "pending",
+ Done = "done",
+ Aborting = "aborting",
+ Aborted = "aborted",
+ Suspended = "suspended",
+ Failed = "failed",
+ // Only used for the notification, never in the transaction history
+ Deleted = "deleted",
+ // Placeholder until D37 is fully implemented
+ Unknown = "unknown",
+}
+
+export enum TransactionSubstate {
+ // Placeholder until D37 is fully implemented
+ Unknown = "unknown",
+ // No substate
+ None = "none",
+ DepositPendingInitial = "initial",
+ DepositKycRequired = "kyc-required",
+ DepositPendingTrack = "track",
+ DepositAbortingRefresh = "refresh",
+}
+
export interface TransactionsResponse {
// a list of past and pending transactions sorted by pending, timestamp and transactionId.
// In case two events are both pending and have the same timestamp,
@@ -95,6 +126,13 @@ export interface TransactionCommon {
// main timestamp of the transaction
timestamp: TalerProtocolTimestamp;
+ txState: TransactionState;
+
+ txSubstate: TransactionSubstate;
+
+ /**
+ * @deprecated in favor of statusMajor and statusMinor
+ */
extendedStatus: ExtendedStatus;
/**
diff --git a/packages/taler-util/src/wallet-types.ts b/packages/taler-util/src/wallet-types.ts
index 11162df14..dea6bd361 100644
--- a/packages/taler-util/src/wallet-types.ts
+++ b/packages/taler-util/src/wallet-types.ts
@@ -1228,8 +1228,7 @@ export const codecForTestPayArgs = (): Codec<TestPayArgs> =>
export interface IntegrationTestArgs {
exchangeBaseUrl: string;
- bankBaseUrl: string;
- bankAccessApiBaseUrl?: string;
+ bankAccessApiBaseUrl: string;
merchantBaseUrl: string;
merchantAuthToken?: string;
amountToWithdraw: string;
@@ -1239,12 +1238,11 @@ export interface IntegrationTestArgs {
export const codecForIntegrationTestArgs = (): Codec<IntegrationTestArgs> =>
buildCodecForObject<IntegrationTestArgs>()
.property("exchangeBaseUrl", codecForString())
- .property("bankBaseUrl", codecForString())
.property("merchantBaseUrl", codecForString())
.property("merchantAuthToken", codecOptional(codecForString()))
.property("amountToSpend", codecForAmountString())
.property("amountToWithdraw", codecForAmountString())
- .property("bankAccessApiBaseUrl", codecOptional(codecForAmountString()))
+ .property("bankAccessApiBaseUrl", codecForAmountString())
.build("IntegrationTestArgs");
export interface IntegrationTestV2Args {
@@ -1499,11 +1497,10 @@ export interface CoreApiResponseError {
export interface WithdrawTestBalanceRequest {
amount: string;
- bankBaseUrl: string;
/**
- * Bank access API base URL. Defaults to the bankBaseUrl.
+ * Bank access API base URL.
*/
- bankAccessApiBaseUrl?: string;
+ bankAccessApiBaseUrl: string;
exchangeBaseUrl: string;
forcedDenomSel?: ForcedDenomSel;
}
@@ -1580,10 +1577,9 @@ export const codecForWithdrawTestBalance =
(): Codec<WithdrawTestBalanceRequest> =>
buildCodecForObject<WithdrawTestBalanceRequest>()
.property("amount", codecForString())
- .property("bankBaseUrl", codecForString())
.property("exchangeBaseUrl", codecForString())
.property("forcedDenomSel", codecForAny())
- .property("bankAccessApiBaseUrl", codecOptional(codecForString()))
+ .property("bankAccessApiBaseUrl", codecForString())
.build("WithdrawTestBalanceRequest");
export interface ApplyRefundResponse {
@@ -1702,11 +1698,6 @@ export const codecForAbortTransaction = (): Codec<AbortTransactionRequest> =>
.property("forceImmediateAbort", codecOptional(codecForBoolean()))
.build("AbortTransactionRequest");
-export interface GetFeeForDepositRequest {
- depositPaytoUri: string;
- amount: AmountString;
-}
-
export interface DepositGroupFees {
coin: AmountString;
wire: AmountString;
@@ -1718,12 +1709,6 @@ export interface CreateDepositGroupRequest {
amount: AmountString;
}
-export const codecForGetFeeForDeposit = (): Codec<GetFeeForDepositRequest> =>
- buildCodecForObject<GetFeeForDepositRequest>()
- .property("amount", codecForAmountString())
- .property("depositPaytoUri", codecForString())
- .build("GetFeeForDepositRequest");
-
export interface PrepareDepositRequest {
depositPaytoUri: string;
amount: AmountString;
@@ -1751,20 +1736,6 @@ export interface CreateDepositGroupResponse {
transactionId: string;
}
-export interface TrackDepositGroupRequest {
- depositGroupId: string;
-}
-
-export interface TrackDepositGroupResponse {
- responses: TrackTransaction[];
-}
-
-export const codecForTrackDepositGroupRequest =
- (): Codec<TrackDepositGroupRequest> =>
- buildCodecForObject<TrackDepositGroupRequest>()
- .property("depositGroupId", codecForAmountString())
- .build("TrackDepositGroupRequest");
-
export interface WithdrawUriInfoResponse {
amount: AmountString;
defaultExchangeBaseUrl?: string;