import { ApiResponse , RequestOptions } from '../core' ; import { CaptureTransactionResponse , captureTransactionResponseSchema , } from '../models/captureTransactionResponse' ; import { ListTransactionsResponse , listTransactionsResponseSchema , } from '../models/listTransactionsResponse' ; import { RetrieveTransactionResponse , retrieveTransactionResponseSchema , } from '../models/retrieveTransactionResponse' ; import { VoidTransactionResponse , voidTransactionResponseSchema , } from '../models/voidTransactionResponse' ; import { optional , string } from '../schema' ; import { BaseApi } from './baseApi' ; export class TransactionsApi extends BaseApi { param locationId param beginTime param endTime param sortOrder param cursor return deprecated async listTransactions ( locationId , beginTime ? , endTime ? , sortOrder ? , cursor ? , requestOptions ? ) { const req = this . createRequest ( 'GET' ) ; const mapped = req . prepareArgs ( { locationId : [ locationId , string ( ) ] , beginTime : [ beginTime , optional ( string ( ) ) ] , endTime : [ endTime , optional ( string ( ) ) ] , sortOrder : [ sortOrder , optional ( string ( ) ) ] , cursor : [ cursor , optional ( string ( ) ) ] , } ) ; req . query ( 'begin_time' , mapped . beginTime ) ; req . query ( 'end_time' , mapped . endTime ) ; req . query ( 'sort_order' , mapped . sortOrder ) ; req . query ( 'cursor' , mapped . cursor ) ; req . appendTemplatePath `/v2/locations/${ mapped . locationId }/transactions` ; req . deprecated ( 'TransactionsApi.listTransactions' ) ; return req . callAsJson ( listTransactionsResponseSchema , requestOptions ) ; } param locationId param transactionId return deprecated async retrieveTransaction ( locationId , transactionId , requestOptions ? ) { const req = this . createRequest ( 'GET' ) ; const mapped = req . prepareArgs ( { locationId : [ locationId , string ( ) ] , transactionId : [ transactionId , string ( ) ] , } ) ; req . appendTemplatePath `/v2/locations/${ mapped . locationId }/transactions/${ mapped . transactionId }` ; req . deprecated ( 'TransactionsApi.retrieveTransaction' ) ; return req . callAsJson ( retrieveTransactionResponseSchema , requestOptions ) ; } param locationId param transactionId return deprecated async captureTransaction ( locationId , transactionId , requestOptions ? ) { const req = this . createRequest ( 'POST' ) ; const mapped = req . prepareArgs ( { locationId : [ locationId , string ( ) ] , transactionId : [ transactionId , string ( ) ] , } ) ; req . appendTemplatePath `/v2/locations/${ mapped . locationId }/transactions/${ mapped . transactionId }/capture` ; req . deprecated ( 'TransactionsApi.captureTransaction' ) ; return req . callAsJson ( captureTransactionResponseSchema , requestOptions ) ; } param locationId param transactionId return deprecated async voidTransaction ( locationId , transactionId , requestOptions ? ) { const req = this . createRequest ( 'POST' ) ; const mapped = req . prepareArgs ( { locationId : [ locationId , string ( ) ] , transactionId : [ transactionId , string ( ) ] , } ) ; req . appendTemplatePath `/v2/locations/${ mapped . locationId }/transactions/${ mapped . transactionId }/void` ; req . deprecated ( 'TransactionsApi.voidTransaction' ) ; return req . callAsJson ( voidTransactionResponseSchema , requestOptions ) ; } }