import type { Square } from "square" import { defineSquareOperation } from "../lib" /** Adds a card on file to an existing merchant. */ export const createSquareCard = defineSquareOperation< Square.CreateCardRequest, Square.CreateCardResponse >({ allowedKeys: ["idempotencyKey", "sourceId", "verificationToken", "card"], description: "Adds a card on file to an existing merchant.", execute: (api, input) => api.cards.create(input), name: "Create Square Card", replaySafety: "safe", requiredKeys: ["idempotencyKey", "sourceId", "card"], scopes: ["PAYMENTS_WRITE"], }) /** Disables the card, preventing any further updates or charges. */ export const disableSquareCard = defineSquareOperation< Square.DisableCardsRequest, Square.DisableCardResponse >({ allowedKeys: ["cardId"], description: "Disables the card, preventing any further updates or charges.", execute: (api, input) => api.cards.disable(input), name: "Disable Square Card", replaySafety: "unsafe", requiredKeys: ["cardId"], scopes: ["PAYMENTS_WRITE"], }) /** Retrieves a list of cards owned by the account making the request. */ export const listSquareCards = defineSquareOperation< Square.ListCardsRequest, Square.ListCardsResponse >({ allowedKeys: [ "cursor", "customerId", "includeDisabled", "referenceId", "sortOrder", ], description: "Retrieves a list of cards owned by the account making the request.", execute: (api, input) => api.cards.list(input), name: "List Square Cards", replaySafety: "safe", requiredKeys: [], scopes: ["PAYMENTS_READ"], }) /** Retrieves details for a specific Card. */ export const retrieveSquareCard = defineSquareOperation< Square.GetCardsRequest, Square.GetCardResponse >({ allowedKeys: ["cardId"], description: "Retrieves details for a specific Card.", execute: (api, input) => api.cards.get(input), name: "Retrieve Square Card", replaySafety: "safe", requiredKeys: ["cardId"], scopes: ["PAYMENTS_READ"], })