import { ApiResponse , RequestOptions } from '../core' ; import { CancelTerminalCheckoutResponse , cancelTerminalCheckoutResponseSchema , } from '../models/cancelTerminalCheckoutResponse' ; import { CancelTerminalRefundResponse , cancelTerminalRefundResponseSchema , } from '../models/cancelTerminalRefundResponse' ; import { CreateTerminalCheckoutRequest , createTerminalCheckoutRequestSchema , } from '../models/createTerminalCheckoutRequest' ; import { CreateTerminalCheckoutResponse , createTerminalCheckoutResponseSchema , } from '../models/createTerminalCheckoutResponse' ; import { CreateTerminalRefundRequest , createTerminalRefundRequestSchema , } from '../models/createTerminalRefundRequest' ; import { CreateTerminalRefundResponse , createTerminalRefundResponseSchema , } from '../models/createTerminalRefundResponse' ; import { GetTerminalCheckoutResponse , getTerminalCheckoutResponseSchema , } from '../models/getTerminalCheckoutResponse' ; import { GetTerminalRefundResponse , getTerminalRefundResponseSchema , } from '../models/getTerminalRefundResponse' ; import { SearchTerminalCheckoutsRequest , searchTerminalCheckoutsRequestSchema , } from '../models/searchTerminalCheckoutsRequest' ; import { SearchTerminalCheckoutsResponse , searchTerminalCheckoutsResponseSchema , } from '../models/searchTerminalCheckoutsResponse' ; import { SearchTerminalRefundsRequest , searchTerminalRefundsRequestSchema , } from '../models/searchTerminalRefundsRequest' ; import { SearchTerminalRefundsResponse , searchTerminalRefundsResponseSchema , } from '../models/searchTerminalRefundsResponse' ; import { string } from '../schema' ; import { BaseApi } from './baseApi' ; export class TerminalApi extends BaseApi { param body return async createTerminalCheckout ( body , requestOptions ? ) { const req = this . createRequest ( 'POST' , '/v2/terminals/checkouts' ) ; const mapped = req . prepareArgs ( { body : [ body , createTerminalCheckoutRequestSchema ] , } ) ; req . header ( 'Content-Type' , 'application/json' ) ; req . json ( mapped . body ) ; return req . callAsJson ( createTerminalCheckoutResponseSchema , requestOptions ) ; } param body return async searchTerminalCheckouts ( body , requestOptions ? ) { const req = this . createRequest ( 'POST' , '/v2/terminals/checkouts/search' ) ; const mapped = req . prepareArgs ( { body : [ body , searchTerminalCheckoutsRequestSchema ] , } ) ; req . header ( 'Content-Type' , 'application/json' ) ; req . json ( mapped . body ) ; return req . callAsJson ( searchTerminalCheckoutsResponseSchema , requestOptions ) ; } param checkoutId return async getTerminalCheckout ( checkoutId , requestOptions ? ) { const req = this . createRequest ( 'GET' ) ; const mapped = req . prepareArgs ( { checkoutId : [ checkoutId , string ( ) ] } ) ; req . appendTemplatePath `/v2/terminals/checkouts/${ mapped . checkoutId }` ; return req . callAsJson ( getTerminalCheckoutResponseSchema , requestOptions ) ; } param checkoutId return async cancelTerminalCheckout ( checkoutId , requestOptions ? ) { const req = this . createRequest ( 'POST' ) ; const mapped = req . prepareArgs ( { checkoutId : [ checkoutId , string ( ) ] } ) ; req . appendTemplatePath `/v2/terminals/checkouts/${ mapped . checkoutId }/cancel` ; return req . callAsJson ( cancelTerminalCheckoutResponseSchema , requestOptions ) ; } param body return async createTerminalRefund ( body , requestOptions ? ) { const req = this . createRequest ( 'POST' , '/v2/terminals/refunds' ) ; const mapped = req . prepareArgs ( { body : [ body , createTerminalRefundRequestSchema ] , } ) ; req . header ( 'Content-Type' , 'application/json' ) ; req . json ( mapped . body ) ; return req . callAsJson ( createTerminalRefundResponseSchema , requestOptions ) ; } param body return async searchTerminalRefunds ( body , requestOptions ? ) { const req = this . createRequest ( 'POST' , '/v2/terminals/refunds/search' ) ; const mapped = req . prepareArgs ( { body : [ body , searchTerminalRefundsRequestSchema ] , } ) ; req . header ( 'Content-Type' , 'application/json' ) ; req . json ( mapped . body ) ; return req . callAsJson ( searchTerminalRefundsResponseSchema , requestOptions ) ; } param terminalRefundId return async getTerminalRefund ( terminalRefundId , requestOptions ? ) { const req = this . createRequest ( 'GET' ) ; const mapped = req . prepareArgs ( { terminalRefundId : [ terminalRefundId , string ( ) ] , } ) ; req . appendTemplatePath `/v2/terminals/refunds/${ mapped . terminalRefundId }` ; return req . callAsJson ( getTerminalRefundResponseSchema , requestOptions ) ; } param terminalRefundId return async cancelTerminalRefund ( terminalRefundId , requestOptions ? ) { const req = this . createRequest ( 'POST' ) ; const mapped = req . prepareArgs ( { terminalRefundId : [ terminalRefundId , string ( ) ] , } ) ; req . appendTemplatePath `/v2/terminals/refunds/${ mapped . terminalRefundId }/cancel` ; return req . callAsJson ( cancelTerminalRefundResponseSchema , requestOptions ) ; } }