import type { Square } from "square" import { defineSquareOperation } from "../lib" /** Store a bank account on file for a square account. */ export const createSquareBankAccount = defineSquareOperation< Square.CreateBankAccountRequest, Square.CreateBankAccountResponse >({ allowedKeys: ["idempotencyKey", "sourceId", "customerId"], description: "Store a bank account on file for a square account.", execute: (api, input) => api.bankAccounts.createBankAccount(input), name: "Create Square Bank Account", replaySafety: "safe", requiredKeys: ["idempotencyKey", "sourceId"], scopes: ["BANK_ACCOUNTS_WRITE"], }) /** Disable a bank account. */ export const disableSquareBankAccount = defineSquareOperation< Square.DisableBankAccountRequest, Square.DisableBankAccountResponse >({ allowedKeys: ["bankAccountId"], description: "Disable a bank account.", execute: (api, input) => api.bankAccounts.disableBankAccount(input), name: "Disable Square Bank Account", replaySafety: "unsafe", requiredKeys: ["bankAccountId"], scopes: ["BANK_ACCOUNTS_WRITE"], }) /** * Retrieve details of a [BankAccount](entity:BankAccount) bank account linked * to a Square account. */ export const getSquareBankAccount = defineSquareOperation< Square.GetBankAccountsRequest, Square.GetBankAccountResponse >({ allowedKeys: ["bankAccountId"], description: "Retrieve details of a [BankAccount](entity:BankAccount) bank account linked to a Square account.", execute: (api, input) => api.bankAccounts.get(input), name: "Get Square Bank Account", replaySafety: "safe", requiredKeys: ["bankAccountId"], scopes: ["BANK_ACCOUNTS_READ"], }) /** * Returns details of a [BankAccount](entity:BankAccount) identified by V1 bank * account ID. */ export const getSquareBankAccountByV1Id = defineSquareOperation< Square.GetByV1IdBankAccountsRequest, Square.GetBankAccountByV1IdResponse >({ allowedKeys: ["v1BankAccountId"], description: "Returns details of a [BankAccount](entity:BankAccount) identified by V1 bank account ID.", execute: (api, input) => api.bankAccounts.getByV1Id(input), name: "Get Square Bank Account By V1 Id", replaySafety: "safe", requiredKeys: ["v1BankAccountId"], scopes: ["BANK_ACCOUNTS_READ"], }) /** * Returns a list of [BankAccount](entity:BankAccount) objects linked to a * Square account. */ export const listSquareBankAccounts = defineSquareOperation< Square.ListBankAccountsRequest, Square.ListBankAccountsResponse >({ allowedKeys: ["cursor", "limit", "locationId", "customerId"], description: "Returns a list of [BankAccount](entity:BankAccount) objects linked to a Square account.", execute: (api, input) => api.bankAccounts.list(input), name: "List Square Bank Accounts", replaySafety: "safe", requiredKeys: [], scopes: ["BANK_ACCOUNTS_READ"], })