import type { Square } from "square" import { defineSquareOperation } from "../lib" /** Retrieves a specific refund using the `refund_id`. */ export const getSquarePaymentRefund = defineSquareOperation< Square.GetRefundsRequest, Square.GetPaymentRefundResponse >({ allowedKeys: ["refundId"], description: "Retrieves a specific refund using the `refund_id`.", execute: (api, input) => api.refunds.get(input), name: "Get Square Payment Refund", replaySafety: "safe", requiredKeys: ["refundId"], scopes: ["PAYMENTS_READ"], }) /** Retrieves a list of refunds for the account making the request. */ export const listSquarePaymentRefunds = defineSquareOperation< Square.ListRefundsRequest, Square.ListPaymentRefundsResponse >({ allowedKeys: [ "beginTime", "endTime", "sortOrder", "cursor", "locationId", "status", "sourceType", "limit", "updatedAtBeginTime", "updatedAtEndTime", "sortField", ], description: "Retrieves a list of refunds for the account making the request.", execute: (api, input) => api.refunds.list(input), name: "List Square Payment Refunds", replaySafety: "safe", requiredKeys: [], scopes: ["PAYMENTS_READ"], }) /** Refunds a payment. */ export const refundSquarePayment = defineSquareOperation< Square.RefundPaymentRequest, Square.RefundPaymentResponse >({ allowedKeys: [ "idempotencyKey", "amountMoney", "appFeeMoney", "appFeeAllocations", "paymentId", "destinationId", "unlinked", "locationId", "customerId", "reason", "paymentVersionToken", "teamMemberId", "cashDetails", "externalDetails", ], description: "Refunds a payment.", execute: (api, input) => api.refunds.refundPayment(input), name: "Refund Square Payment", replaySafety: "safe", requiredKeys: ["idempotencyKey", "amountMoney"], scopes: ["PAYMENTS_WRITE"], })