From 5e1f450a20aa00c1783337a3b6024167dbc568bd Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 4 May 2023 10:40:52 -0300 Subject: remove unused types --- .../merchant-backoffice-ui/src/declaration.d.ts | 143 --------------------- .../src/hooks/reserve.test.ts | 10 +- .../merchant-backoffice-ui/src/hooks/transfer.ts | 20 +-- 3 files changed, 11 insertions(+), 162 deletions(-) (limited to 'packages/merchant-backoffice-ui') diff --git a/packages/merchant-backoffice-ui/src/declaration.d.ts b/packages/merchant-backoffice-ui/src/declaration.d.ts index 2c5730666..8afa2f781 100644 --- a/packages/merchant-backoffice-ui/src/declaration.d.ts +++ b/packages/merchant-backoffice-ui/src/declaration.d.ts @@ -1237,149 +1237,6 @@ export namespace MerchantBackend { // base URL of the exchange that made the wire transfer exchange_url: string; } - interface MerchantTrackTransferResponse { - // Total amount transferred - total: Amount; - - // Applicable wire fee that was charged - wire_fee: Amount; - - // Time of the execution of the wire transfer by the exchange, according to the exchange - execution_time: Timestamp; - - // details about the deposits - deposits_sums: MerchantTrackTransferDetail[]; - } - interface MerchantTrackTransferDetail { - // Business activity associated with the wire transferred amount - // deposit_value. - order_id: string; - - // The total amount the exchange paid back for order_id. - deposit_value: Amount; - - // applicable fees for the deposit - deposit_fee: Amount; - } - - type ExchangeConflictDetails = - | WireFeeConflictDetails - | TrackTransferConflictDetails; - // Note: this is not the full 'proof' of missbehavior, as - // the bogus message from the exchange with a signature - // over the 'different' wire fee is missing. - // - // This information is NOT provided by the current implementation, - // because this would be quite expensive to generate and is - // hardly needed _here_. Once we add automated reports for - // the Taler auditor, we need to generate this data anyway - // and should probably return it here as well. - interface WireFeeConflictDetails { - // Numerical error code: - code: "TALER_EC_MERCHANT_PRIVATE_POST_TRANSFERS_BAD_WIRE_FEE"; - - // Text describing the issue for humans. - hint: string; - - // Wire fee (wrongly) charged by the exchange, breaking the - // contract affirmed by the exchange_sig. - wire_fee: Amount; - - // Timestamp of the wire transfer - execution_time: Timestamp; - - // The expected wire fee (as signed by the exchange) - expected_wire_fee: Amount; - - // Expected closing fee (needed to verify signature) - expected_closing_fee: Amount; - - // Start date of the expected fee structure - start_date: Timestamp; - - // End date of the expected fee structure - end_date: Timestamp; - - // Signature of the exchange affirming the expected fee structure - master_sig: EddsaSignature; - - // Master public key of the exchange - master_pub: EddsaPublicKey; - } - interface TrackTransferConflictDetails { - // Numerical error code - code: "TALER_EC_MERCHANT_PRIVATE_POST_TRANSFERS_CONFLICTING_REPORTS"; - - // Text describing the issue for humans. - hint: string; - - // Offset in the exchange_transfer where the - // exchange's response fails to match the exchange_deposit_proof. - conflict_offset: number; - - // The response from the exchange which tells us when the - // coin was returned to us, except that it does not match - // the expected value of the coin. - // - // This field is NOT provided by the current implementation, - // because this would be quite expensive to generate and is - // hardly needed _here_. Once we add automated reports for - // the Taler auditor, we need to generate this data anyway - // and should probably return it here as well. - // exchange_transfer?: TrackTransferResponse; - - // Public key of the exchange used to sign the response to - // our deposit request. - deposit_exchange_pub: EddsaPublicKey; - - // Signature of the exchange signing the (conflicting) response. - // Signs over a struct TALER_DepositConfirmationPS. - deposit_exchange_sig: EddsaSignature; - - // Hash of the merchant's bank account the wire transfer went to - h_wire: HashCode; - - // Hash of the contract terms with the conflicting deposit. - h_contract_terms: HashCode; - - // At what time the exchange received the deposit. Needed - // to verify the \exchange_sig\. - deposit_timestamp: Timestamp; - - // At what time the refund possibility expired (needed to verify exchange_sig). - refund_deadline: Timestamp; - - // Public key of the coin for which we have conflicting information. - coin_pub: EddsaPublicKey; - - // Amount the exchange counted the coin for in the transfer. - amount_with_fee: Amount; - - // Expected value of the coin. - coin_value: Amount; - - // Expected deposit fee of the coin. - coin_fee: Amount; - - // Expected deposit fee of the coin. - deposit_fee: Amount; - } - - // interface TrackTransferProof { - // // signature from the exchange made with purpose - // // TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE_DEPOSIT - // exchange_sig: EddsaSignature; - - // // public EdDSA key of the exchange that was used to generate the signature. - // // Should match one of the exchange's signing keys from /keys. Again given - // // explicitly as the client might otherwise be confused by clock skew as to - // // which signing key was used. - // exchange_pub: EddsaSignature; - - // // hash of the wire details (identical for all deposits) - // // Needed to check the exchange_sig - // h_wire: HashCode; - // } } namespace Template { diff --git a/packages/merchant-backoffice-ui/src/hooks/reserve.test.ts b/packages/merchant-backoffice-ui/src/hooks/reserve.test.ts index 79c8c9229..a7b97794d 100644 --- a/packages/merchant-backoffice-ui/src/hooks/reserve.test.ts +++ b/packages/merchant-backoffice-ui/src/hooks/reserve.test.ts @@ -80,7 +80,7 @@ describe("reserve api interaction with listing", () => { }, response: { reserve_pub: "22", - payto_uri: "payto", + accounts: [], }, }); @@ -218,7 +218,7 @@ describe("reserve api interaction with details", () => { env.addRequestExpectation(API_GET_RESERVE_BY_ID("11"), { response: { - payto_uri: "payto://here", + accounts: [{ payto_uri: "payto://here" }], tips: [{ reason: "why?", tip_id: "id1", total_amount: "USD:10" }], } as MerchantBackend.Tips.ReserveDetail, qparam: { @@ -265,7 +265,7 @@ describe("reserve api interaction with details", () => { env.addRequestExpectation(API_GET_RESERVE_BY_ID("11"), { response: { - payto_uri: "payto://here", + accounts: [{ payto_uri: "payto://here" }], tips: [ { reason: "why?", tip_id: "id1", total_amount: "USD:10" }, { reason: "not", tip_id: "id2", total_amount: "USD:12" }, @@ -313,7 +313,7 @@ describe("reserve api interaction with details", () => { env.addRequestExpectation(API_GET_RESERVE_BY_ID("11"), { response: { - payto_uri: "payto://here", + accounts: [{ payto_uri: "payto://here" }], tips: [{ reason: "why?", tip_id: "id1", total_amount: "USD:10" }], } as MerchantBackend.Tips.ReserveDetail, qparam: { @@ -360,7 +360,7 @@ describe("reserve api interaction with details", () => { env.addRequestExpectation(API_GET_RESERVE_BY_ID("11"), { response: { - payto_uri: "payto://here", + accounts: [{ payto_uri: "payto://here" }], tips: [ { reason: "why?", tip_id: "id1", total_amount: "USD:10" }, { reason: "not", tip_id: "id2", total_amount: "USD:12" }, diff --git a/packages/merchant-backoffice-ui/src/hooks/transfer.ts b/packages/merchant-backoffice-ui/src/hooks/transfer.ts index e21dd1dd5..649cef06c 100644 --- a/packages/merchant-backoffice-ui/src/hooks/transfer.ts +++ b/packages/merchant-backoffice-ui/src/hooks/transfer.ts @@ -34,17 +34,11 @@ export function useTransferAPI(): TransferAPI { const informTransfer = async ( data: MerchantBackend.Transfers.TransferInformation, - ): Promise< - HttpResponseOk - > => { - const res = - await request( - `/private/transfers`, - { - method: "POST", - data, - }, - ); + ): Promise> => { + const res = await request<{}>(`/private/transfers`, { + method: "POST", + data, + }); await mutateAll(/.*private\/transfers.*/); return res; @@ -56,9 +50,7 @@ export function useTransferAPI(): TransferAPI { export interface TransferAPI { informTransfer: ( data: MerchantBackend.Transfers.TransferInformation, - ) => Promise< - HttpResponseOk - >; + ) => Promise>; } export interface InstanceTransferFilter { -- cgit v1.2.3