teamdigitale/italia-app

View on GitHub
ts/store/actions/wallet/delete.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { ActionType, createAsyncAction } from "typesafe-actions";
import { EnableableFunctionsEnum } from "../../../../definitions/pagopa/EnableableFunctions";
import { Wallet } from "../../../types/pagopa";

export type DeleteAllByFunctionSuccess = {
  wallets: ReadonlyArray<Wallet>;
  deletedMethodsCount: number;
};

export type DeleteAllByFunctionError = {
  error: Error;
  notDeletedMethodsCount?: number;
};
/**
 * used to delete all those payment methods that have a specified function enabled
 */
export const deleteAllPaymentMethodsByFunction = createAsyncAction(
  "WALLETS_DELETE_ALL_BY_FUNCTION_REQUEST",
  "WALLETS_DELETE_ALL_BY_FUNCTION_SUCCESS",
  "WALLETS_DELETE_ALL_BY_FUNCTION_FAILURE"
)<
  EnableableFunctionsEnum,
  DeleteAllByFunctionSuccess,
  DeleteAllByFunctionError
>();

export type DeleteActions = ActionType<
  typeof deleteAllPaymentMethodsByFunction
>;