/** * Import types from Nadal. */ import type { PaymentBankListResponseData, PaymentBankScheduleResponseData, } from '@kira-dancer/nadal' import { defineStore } from 'pinia' import { AppStoreEnum } from '#lib/enums' import type { BankListItem, CryptoItem, DepositStoreState, EWalletItem, FastpayItem, PhoneCardProvider, } from '#lib/types' import { DEFAULT_DEPOSIT_STORE_STATE } from '#lib/constants' export const usePaymentStore = defineStore(AppStoreEnum.Deposit, { state: (): DepositStoreState => ({ ...DEFAULT_DEPOSIT_STORE_STATE, }), persist: false, actions: { setEWalletCode(code: string) { this.eWalletCode = code }, setEWallet(data: EWalletItem[]) { this.eWallets = data }, setCryptos(listCrypto: CryptoItem[]) { this.cryptos = listCrypto }, setCryptoTimeLeft(cryptoTimeLeft: number) { this.cryptoTimeLeft = cryptoTimeLeft }, setFastpayCode(code: string) { this.fastpayCode = code }, setTpayCode(code: string) { this.tpayCode = code }, setPhoneCardProviders(telecoms: PhoneCardProvider[]) { this.phoneCardProviders = telecoms }, setWithdrawBanks(banks: PaymentBankListResponseData[]) { this.withdrawBanks = banks }, resetWithdrawBanks() { this.withdrawBanks = [] }, setPaywinBanks(banks: BankListItem[]) { this.paywinBanks = banks }, resetPaywinBanks() { this.paywinBanks = [] }, setDepositFastPays(data: FastpayItem[]) { this.depositFastPays = data }, setBankSchedules(data: PaymentBankScheduleResponseData[]) { this.bankSchedules = data }, setIsFetchData(isFetch: boolean) { this.isFetchData = isFetch }, setMaintainedPhoneCardWithdraw(status: boolean) { this.isMaintainedPhoneCardWithdraw = status }, setMaintainedTpayDeposit(status: boolean) { this.isMaintainedTpayDeposit = status }, resetBankSchedules() { this.bankSchedules = [] }, resetDepositCode() { this.isMaintainedTpayDeposit = false this.phoneCardProviders = [] this.depositFastPays = [] this.bankSchedules = [] this.tpayCode = '' this.fastpayCode = '' this.cryptos = [] this.cryptoTimeLeft = 0 this.isMaintainedPhoneCardWithdraw = false this.eWallets = [] this.eWalletCode = '' this.isFetchData = false }, }, })