remove unused types

This commit is contained in:
Sebastian 2023-05-04 10:40:52 -03:00
parent cbf0f83954
commit 5e1f450a20
No known key found for this signature in database
GPG Key ID: 173909D1A5F66069
3 changed files with 11 additions and 162 deletions

View File

@ -1237,149 +1237,6 @@ export namespace MerchantBackend {
// base URL of the exchange that made the wire transfer // base URL of the exchange that made the wire transfer
exchange_url: string; 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 { namespace Template {

View File

@ -80,7 +80,7 @@ describe("reserve api interaction with listing", () => {
}, },
response: { response: {
reserve_pub: "22", 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"), { env.addRequestExpectation(API_GET_RESERVE_BY_ID("11"), {
response: { response: {
payto_uri: "payto://here", accounts: [{ payto_uri: "payto://here" }],
tips: [{ reason: "why?", tip_id: "id1", total_amount: "USD:10" }], tips: [{ reason: "why?", tip_id: "id1", total_amount: "USD:10" }],
} as MerchantBackend.Tips.ReserveDetail, } as MerchantBackend.Tips.ReserveDetail,
qparam: { qparam: {
@ -265,7 +265,7 @@ describe("reserve api interaction with details", () => {
env.addRequestExpectation(API_GET_RESERVE_BY_ID("11"), { env.addRequestExpectation(API_GET_RESERVE_BY_ID("11"), {
response: { response: {
payto_uri: "payto://here", accounts: [{ payto_uri: "payto://here" }],
tips: [ tips: [
{ reason: "why?", tip_id: "id1", total_amount: "USD:10" }, { reason: "why?", tip_id: "id1", total_amount: "USD:10" },
{ reason: "not", tip_id: "id2", total_amount: "USD:12" }, { 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"), { env.addRequestExpectation(API_GET_RESERVE_BY_ID("11"), {
response: { response: {
payto_uri: "payto://here", accounts: [{ payto_uri: "payto://here" }],
tips: [{ reason: "why?", tip_id: "id1", total_amount: "USD:10" }], tips: [{ reason: "why?", tip_id: "id1", total_amount: "USD:10" }],
} as MerchantBackend.Tips.ReserveDetail, } as MerchantBackend.Tips.ReserveDetail,
qparam: { qparam: {
@ -360,7 +360,7 @@ describe("reserve api interaction with details", () => {
env.addRequestExpectation(API_GET_RESERVE_BY_ID("11"), { env.addRequestExpectation(API_GET_RESERVE_BY_ID("11"), {
response: { response: {
payto_uri: "payto://here", accounts: [{ payto_uri: "payto://here" }],
tips: [ tips: [
{ reason: "why?", tip_id: "id1", total_amount: "USD:10" }, { reason: "why?", tip_id: "id1", total_amount: "USD:10" },
{ reason: "not", tip_id: "id2", total_amount: "USD:12" }, { reason: "not", tip_id: "id2", total_amount: "USD:12" },

View File

@ -34,17 +34,11 @@ export function useTransferAPI(): TransferAPI {
const informTransfer = async ( const informTransfer = async (
data: MerchantBackend.Transfers.TransferInformation, data: MerchantBackend.Transfers.TransferInformation,
): Promise< ): Promise<HttpResponseOk<{}>> => {
HttpResponseOk<MerchantBackend.Transfers.MerchantTrackTransferResponse> const res = await request<{}>(`/private/transfers`, {
> => { method: "POST",
const res = data,
await request<MerchantBackend.Transfers.MerchantTrackTransferResponse>( });
`/private/transfers`,
{
method: "POST",
data,
},
);
await mutateAll(/.*private\/transfers.*/); await mutateAll(/.*private\/transfers.*/);
return res; return res;
@ -56,9 +50,7 @@ export function useTransferAPI(): TransferAPI {
export interface TransferAPI { export interface TransferAPI {
informTransfer: ( informTransfer: (
data: MerchantBackend.Transfers.TransferInformation, data: MerchantBackend.Transfers.TransferInformation,
) => Promise< ) => Promise<HttpResponseOk<{}>>;
HttpResponseOk<MerchantBackend.Transfers.MerchantTrackTransferResponse>
>;
} }
export interface InstanceTransferFilter { export interface InstanceTransferFilter {