import type { Square } from "square" import { defineSquareOperation } from "../lib" /** Cancels a Terminal action request if the status of the request permits it. */ export const cancelSquareTerminalAction = defineSquareOperation< Square.terminal.CancelActionsRequest, Square.CancelTerminalActionResponse >({ allowedKeys: ["actionId"], description: "Cancels a Terminal action request if the status of the request permits it.", execute: (api, input) => api.terminal.actions.cancel(input), name: "Cancel Square Terminal Action", replaySafety: "unsafe", requiredKeys: ["actionId"], scopes: ["PAYMENTS_WRITE"], }) /** Cancels a Terminal checkout request if the status of the request permits it. */ export const cancelSquareTerminalCheckout = defineSquareOperation< Square.terminal.CancelCheckoutsRequest, Square.CancelTerminalCheckoutResponse >({ allowedKeys: ["checkoutId"], description: "Cancels a Terminal checkout request if the status of the request permits it.", execute: (api, input) => api.terminal.checkouts.cancel(input), name: "Cancel Square Terminal Checkout", replaySafety: "unsafe", requiredKeys: ["checkoutId"], scopes: ["PAYMENTS_WRITE"], }) /** * Cancels an Interac Terminal refund request by refund request ID if the status * of the request permits it. */ export const cancelSquareTerminalRefund = defineSquareOperation< Square.terminal.CancelRefundsRequest, Square.CancelTerminalRefundResponse >({ allowedKeys: ["terminalRefundId"], description: "Cancels an Interac Terminal refund request by refund request ID if the status of the request permits it.", execute: (api, input) => api.terminal.refunds.cancel(input), name: "Cancel Square Terminal Refund", replaySafety: "unsafe", requiredKeys: ["terminalRefundId"], scopes: ["PAYMENTS_WRITE"], }) /** Creates a Terminal action request and sends it to the specified device. */ export const createSquareTerminalAction = defineSquareOperation< Square.terminal.CreateTerminalActionRequest, Square.CreateTerminalActionResponse >({ allowedKeys: ["idempotencyKey", "action"], description: "Creates a Terminal action request and sends it to the specified device.", execute: (api, input) => api.terminal.actions.create(input), name: "Create Square Terminal Action", replaySafety: "safe", requiredKeys: ["idempotencyKey", "action"], scopes: ["PAYMENTS_WRITE"], }) /** * Creates a Terminal checkout request and sends it to the specified device to * take a payment for the requested amount. */ export const createSquareTerminalCheckout = defineSquareOperation< Square.terminal.CreateTerminalCheckoutRequest, Square.CreateTerminalCheckoutResponse >({ allowedKeys: ["idempotencyKey", "checkout"], description: "Creates a Terminal checkout request and sends it to the specified device to take a payment for the requested amount.", execute: (api, input) => api.terminal.checkouts.create(input), name: "Create Square Terminal Checkout", replaySafety: "safe", requiredKeys: ["idempotencyKey", "checkout"], scopes: ["PAYMENTS_WRITE"], }) /** * Creates a request to refund an Interac payment completed on a Square * Terminal. */ export const createSquareTerminalRefund = defineSquareOperation< Square.terminal.CreateTerminalRefundRequest, Square.CreateTerminalRefundResponse >({ allowedKeys: ["idempotencyKey", "refund"], description: "Creates a request to refund an Interac payment completed on a Square Terminal.", execute: (api, input) => api.terminal.refunds.create(input), name: "Create Square Terminal Refund", replaySafety: "safe", requiredKeys: ["idempotencyKey"], scopes: ["PAYMENTS_WRITE"], }) /** * Dismisses a Terminal action request if the status and type of the request * permits it. */ export const dismissSquareTerminalAction = defineSquareOperation< Square.DismissTerminalActionRequest, Square.DismissTerminalActionResponse >({ allowedKeys: ["actionId"], description: "Dismisses a Terminal action request if the status and type of the request permits it.", execute: (api, input) => api.terminal.dismissTerminalAction(input), name: "Dismiss Square Terminal Action", replaySafety: "unsafe", requiredKeys: ["actionId"], scopes: ["PAYMENTS_WRITE"], }) /** * Dismisses a Terminal checkout request if the status and type of the request * permits it. */ export const dismissSquareTerminalCheckout = defineSquareOperation< Square.DismissTerminalCheckoutRequest, Square.DismissTerminalCheckoutResponse >({ allowedKeys: ["checkoutId"], description: "Dismisses a Terminal checkout request if the status and type of the request permits it.", execute: (api, input) => api.terminal.dismissTerminalCheckout(input), name: "Dismiss Square Terminal Checkout", replaySafety: "unsafe", requiredKeys: ["checkoutId"], scopes: ["PAYMENTS_WRITE"], }) /** * Dismisses a Terminal refund request if the status and type of the request * permits it. */ export const dismissSquareTerminalRefund = defineSquareOperation< Square.DismissTerminalRefundRequest, Square.DismissTerminalRefundResponse >({ allowedKeys: ["terminalRefundId"], description: "Dismisses a Terminal refund request if the status and type of the request permits it.", execute: (api, input) => api.terminal.dismissTerminalRefund(input), name: "Dismiss Square Terminal Refund", replaySafety: "unsafe", requiredKeys: ["terminalRefundId"], scopes: ["PAYMENTS_WRITE"], }) /** Retrieves a Terminal action request by `action_id`. */ export const getSquareTerminalAction = defineSquareOperation< Square.terminal.GetActionsRequest, Square.GetTerminalActionResponse >({ allowedKeys: ["actionId"], description: "Retrieves a Terminal action request by `action_id`.", execute: (api, input) => api.terminal.actions.get(input), name: "Get Square Terminal Action", replaySafety: "safe", requiredKeys: ["actionId"], scopes: ["PAYMENTS_READ"], }) /** Retrieves a Terminal checkout request by `checkout_id`. */ export const getSquareTerminalCheckout = defineSquareOperation< Square.terminal.GetCheckoutsRequest, Square.GetTerminalCheckoutResponse >({ allowedKeys: ["checkoutId"], description: "Retrieves a Terminal checkout request by `checkout_id`.", execute: (api, input) => api.terminal.checkouts.get(input), name: "Get Square Terminal Checkout", replaySafety: "safe", requiredKeys: ["checkoutId"], scopes: ["PAYMENTS_READ"], }) /** Retrieves an Interac Terminal refund object by ID. */ export const getSquareTerminalRefund = defineSquareOperation< Square.terminal.GetRefundsRequest, Square.GetTerminalRefundResponse >({ allowedKeys: ["terminalRefundId"], description: "Retrieves an Interac Terminal refund object by ID.", execute: (api, input) => api.terminal.refunds.get(input), name: "Get Square Terminal Refund", replaySafety: "safe", requiredKeys: ["terminalRefundId"], scopes: ["PAYMENTS_READ"], }) /** * Retrieves a filtered list of Terminal action requests created by the account * making the request. */ export const searchSquareTerminalActions = defineSquareOperation< Square.terminal.SearchTerminalActionsRequest, Square.SearchTerminalActionsResponse >({ allowedKeys: ["query", "cursor", "limit"], description: "Retrieves a filtered list of Terminal action requests created by the account making the request.", execute: (api, input) => api.terminal.actions.search(input), name: "Search Square Terminal Actions", replaySafety: "safe", requiredKeys: [], scopes: ["PAYMENTS_READ"], }) /** * Returns a filtered list of Terminal checkout requests created by the * application making the request. */ export const searchSquareTerminalCheckouts = defineSquareOperation< Square.terminal.SearchTerminalCheckoutsRequest, Square.SearchTerminalCheckoutsResponse >({ allowedKeys: ["query", "cursor", "limit"], description: "Returns a filtered list of Terminal checkout requests created by the application making the request.", execute: (api, input) => api.terminal.checkouts.search(input), name: "Search Square Terminal Checkouts", replaySafety: "safe", requiredKeys: [], scopes: ["PAYMENTS_READ"], }) /** * Retrieves a filtered list of Interac Terminal refund requests created by the * seller making the request. */ export const searchSquareTerminalRefunds = defineSquareOperation< Square.terminal.SearchTerminalRefundsRequest, Square.SearchTerminalRefundsResponse >({ allowedKeys: ["query", "cursor", "limit"], description: "Retrieves a filtered list of Interac Terminal refund requests created by the seller making the request.", execute: (api, input) => api.terminal.refunds.search(input), name: "Search Square Terminal Refunds", replaySafety: "safe", requiredKeys: [], scopes: ["PAYMENTS_READ"], })