wallet-core: more details in refresh transaction
This commit is contained in:
parent
b73accfe4a
commit
bb8bf3cb55
@ -535,8 +535,15 @@ export interface TransactionRefresh extends TransactionCommon {
|
|||||||
/**
|
/**
|
||||||
* Fees, i.e. the effective, negative effect of the refresh
|
* Fees, i.e. the effective, negative effect of the refresh
|
||||||
* on the balance.
|
* on the balance.
|
||||||
|
*
|
||||||
|
* Only applicable for stand-alone refreshes, and zero for
|
||||||
|
* other refreshes where the transaction itself accounts for the
|
||||||
|
* refresh fee.
|
||||||
*/
|
*/
|
||||||
amountEffective: AmountString;
|
amountEffective: AmountString;
|
||||||
|
|
||||||
|
refreshInputAmount: AmountString;
|
||||||
|
refreshOutputAmount: AmountString;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -596,6 +596,11 @@ function buildTransactionForRefresh(
|
|||||||
default:
|
default:
|
||||||
extendedStatus = ExtendedStatus.Pending;
|
extendedStatus = ExtendedStatus.Pending;
|
||||||
}
|
}
|
||||||
|
const inputAmount = Amounts.sumOrZero(
|
||||||
|
refreshGroupRecord.currency,
|
||||||
|
refreshGroupRecord.inputPerCoin,
|
||||||
|
).amount;
|
||||||
|
const outputAmount = Amounts.sumOrZero(refreshGroupRecord.currency, refreshGroupRecord.estimatedOutputPerCoin).amount;
|
||||||
return {
|
return {
|
||||||
type: TransactionType.Refresh,
|
type: TransactionType.Refresh,
|
||||||
refreshReason: refreshGroupRecord.reason,
|
refreshReason: refreshGroupRecord.reason,
|
||||||
@ -605,6 +610,8 @@ function buildTransactionForRefresh(
|
|||||||
amountRaw: Amounts.stringify(
|
amountRaw: Amounts.stringify(
|
||||||
Amounts.zeroOfCurrency(refreshGroupRecord.currency),
|
Amounts.zeroOfCurrency(refreshGroupRecord.currency),
|
||||||
),
|
),
|
||||||
|
refreshInputAmount: Amounts.stringify(inputAmount),
|
||||||
|
refreshOutputAmount: Amounts.stringify(outputAmount),
|
||||||
extendedStatus:
|
extendedStatus:
|
||||||
refreshGroupRecord.operationStatus === RefreshOperationStatus.Finished ||
|
refreshGroupRecord.operationStatus === RefreshOperationStatus.Finished ||
|
||||||
refreshGroupRecord.operationStatus ===
|
refreshGroupRecord.operationStatus ===
|
||||||
|
@ -102,6 +102,8 @@ const exampleData = {
|
|||||||
refresh: {
|
refresh: {
|
||||||
...commonTransaction(),
|
...commonTransaction(),
|
||||||
type: TransactionType.Refresh,
|
type: TransactionType.Refresh,
|
||||||
|
refreshInputAmount: "USD:1",
|
||||||
|
refreshOutputAmount: "USD:0.5",
|
||||||
exchangeBaseUrl: "http://exchange.taler",
|
exchangeBaseUrl: "http://exchange.taler",
|
||||||
refreshReason: RefreshReason.PayMerchant,
|
refreshReason: RefreshReason.PayMerchant,
|
||||||
} as TransactionRefresh,
|
} as TransactionRefresh,
|
||||||
|
@ -126,6 +126,8 @@ const exampleData = {
|
|||||||
refresh: {
|
refresh: {
|
||||||
...commonTransaction,
|
...commonTransaction,
|
||||||
type: TransactionType.Refresh,
|
type: TransactionType.Refresh,
|
||||||
|
refreshInputAmount: "KUDOS:1",
|
||||||
|
refreshOutputAmount: "KUDOS:0.5",
|
||||||
exchangeBaseUrl: "http://exchange.taler",
|
exchangeBaseUrl: "http://exchange.taler",
|
||||||
refreshReason: RefreshReason.Manual,
|
refreshReason: RefreshReason.Manual,
|
||||||
} as TransactionRefresh,
|
} as TransactionRefresh,
|
||||||
|
Loading…
Reference in New Issue
Block a user