import { ApiResponse , RequestOptions } from '../core' ; import { V1CreateRefundRequest , v1CreateRefundRequestSchema , } from '../models/v1CreateRefundRequest' ; import { V1Order , v1OrderSchema } from '../models/v1Order' ; import { V1Payment , v1PaymentSchema } from '../models/v1Payment' ; import { V1Refund , v1RefundSchema } from '../models/v1Refund' ; import { V1Settlement , v1SettlementSchema } from '../models/v1Settlement' ; import { V1UpdateOrderRequest , v1UpdateOrderRequestSchema , } from '../models/v1UpdateOrderRequest' ; import { array , boolean , number , optional , string } from '../schema' ; import { BaseApi } from './baseApi' ; export class V1TransactionsApi extends BaseApi { param locationId param order param limit param batchToken return deprecated async listOrders ( locationId , order ? , limit ? , batchToken ? , requestOptions ? ) { const req = this . createRequest ( 'GET' ) ; const mapped = req . prepareArgs ( { locationId : [ locationId , string ( ) ] , order : [ order , optional ( string ( ) ) ] , limit : [ limit , optional ( number ( ) ) ] , batchToken : [ batchToken , optional ( string ( ) ) ] , } ) ; req . query ( 'order' , mapped . order ) ; req . query ( 'limit' , mapped . limit ) ; req . query ( 'batch_token' , mapped . batchToken ) ; req . appendTemplatePath `/v1/${ mapped . locationId }/orders` ; req . deprecated ( 'V1TransactionsApi.listOrders' ) ; return req . callAsJson ( array ( v1OrderSchema ) , requestOptions ) ; } param locationId param orderId return deprecated async retrieveOrder ( locationId , orderId , requestOptions ? ) { const req = this . createRequest ( 'GET' ) ; const mapped = req . prepareArgs ( { locationId : [ locationId , string ( ) ] , orderId : [ orderId , string ( ) ] , } ) ; req . appendTemplatePath `/v1/${ mapped . locationId }/orders/${ mapped . orderId }` ; req . deprecated ( 'V1TransactionsApi.retrieveOrder' ) ; return req . callAsJson ( v1OrderSchema , requestOptions ) ; } param locationId param orderId param body return deprecated async updateOrder ( locationId , orderId , body , requestOptions ? ) { const req = this . createRequest ( 'PUT' ) ; const mapped = req . prepareArgs ( { locationId : [ locationId , string ( ) ] , orderId : [ orderId , string ( ) ] , body : [ body , v1UpdateOrderRequestSchema ] , } ) ; req . header ( 'Content-Type' , 'application/json' ) ; req . json ( mapped . body ) ; req . appendTemplatePath `/v1/${ mapped . locationId }/orders/${ mapped . orderId }` ; req . deprecated ( 'V1TransactionsApi.updateOrder' ) ; return req . callAsJson ( v1OrderSchema , requestOptions ) ; } param locationId param order param beginTime param endTime param limit param batchToken param includePartial return deprecated async listPayments ( locationId , order ? , beginTime ? , endTime ? , limit ? , batchToken ? , includePartial ? , requestOptions ? ) { const req = this . createRequest ( 'GET' ) ; const mapped = req . prepareArgs ( { locationId : [ locationId , string ( ) ] , order : [ order , optional ( string ( ) ) ] , beginTime : [ beginTime , optional ( string ( ) ) ] , endTime : [ endTime , optional ( string ( ) ) ] , limit : [ limit , optional ( number ( ) ) ] , batchToken : [ batchToken , optional ( string ( ) ) ] , includePartial : [ includePartial , optional ( boolean ( ) ) ] , } ) ; req . query ( 'order' , mapped . order ) ; req . query ( 'begin_time' , mapped . beginTime ) ; req . query ( 'end_time' , mapped . endTime ) ; req . query ( 'limit' , mapped . limit ) ; req . query ( 'batch_token' , mapped . batchToken ) ; req . query ( 'include_partial' , mapped . includePartial ) ; req . appendTemplatePath `/v1/${ mapped . locationId }/payments` ; req . deprecated ( 'V1TransactionsApi.listPayments' ) ; return req . callAsJson ( array ( v1PaymentSchema ) , requestOptions ) ; } param locationId param paymentId return deprecated async retrievePayment ( locationId , paymentId , requestOptions ? ) { const req = this . createRequest ( 'GET' ) ; const mapped = req . prepareArgs ( { locationId : [ locationId , string ( ) ] , paymentId : [ paymentId , string ( ) ] , } ) ; req . appendTemplatePath `/v1/${ mapped . locationId }/payments/${ mapped . paymentId }` ; req . deprecated ( 'V1TransactionsApi.retrievePayment' ) ; return req . callAsJson ( v1PaymentSchema , requestOptions ) ; } param locationId param order param beginTime param endTime param limit param batchToken return deprecated async listRefunds ( locationId , order ? , beginTime ? , endTime ? , limit ? , batchToken ? , requestOptions ? ) { const req = this . createRequest ( 'GET' ) ; const mapped = req . prepareArgs ( { locationId : [ locationId , string ( ) ] , order : [ order , optional ( string ( ) ) ] , beginTime : [ beginTime , optional ( string ( ) ) ] , endTime : [ endTime , optional ( string ( ) ) ] , limit : [ limit , optional ( number ( ) ) ] , batchToken : [ batchToken , optional ( string ( ) ) ] , } ) ; req . query ( 'order' , mapped . order ) ; req . query ( 'begin_time' , mapped . beginTime ) ; req . query ( 'end_time' , mapped . endTime ) ; req . query ( 'limit' , mapped . limit ) ; req . query ( 'batch_token' , mapped . batchToken ) ; req . appendTemplatePath `/v1/${ mapped . locationId }/refunds` ; req . deprecated ( 'V1TransactionsApi.listRefunds' ) ; return req . callAsJson ( array ( v1RefundSchema ) , requestOptions ) ; } param locationId param body return deprecated async createRefund ( locationId , body , requestOptions ? ) { const req = this . createRequest ( 'POST' ) ; const mapped = req . prepareArgs ( { locationId : [ locationId , string ( ) ] , body : [ body , v1CreateRefundRequestSchema ] , } ) ; req . header ( 'Content-Type' , 'application/json' ) ; req . json ( mapped . body ) ; req . appendTemplatePath `/v1/${ mapped . locationId }/refunds` ; req . deprecated ( 'V1TransactionsApi.createRefund' ) ; return req . callAsJson ( v1RefundSchema , requestOptions ) ; } param locationId param order param beginTime param endTime param limit param status param batchToken return deprecated async listSettlements ( locationId , order ? , beginTime ? , endTime ? , limit ? , status ? , batchToken ? , requestOptions ? ) { const req = this . createRequest ( 'GET' ) ; const mapped = req . prepareArgs ( { locationId : [ locationId , string ( ) ] , order : [ order , optional ( string ( ) ) ] , beginTime : [ beginTime , optional ( string ( ) ) ] , endTime : [ endTime , optional ( string ( ) ) ] , limit : [ limit , optional ( number ( ) ) ] , status : [ status , optional ( string ( ) ) ] , batchToken : [ batchToken , optional ( string ( ) ) ] , } ) ; req . query ( 'order' , mapped . order ) ; req . query ( 'begin_time' , mapped . beginTime ) ; req . query ( 'end_time' , mapped . endTime ) ; req . query ( 'limit' , mapped . limit ) ; req . query ( 'status' , mapped . status ) ; req . query ( 'batch_token' , mapped . batchToken ) ; req . appendTemplatePath `/v1/${ mapped . locationId }/settlements` ; req . deprecated ( 'V1TransactionsApi.listSettlements' ) ; return req . callAsJson ( array ( v1SettlementSchema ) , requestOptions ) ; } param locationId param settlementId return deprecated async retrieveSettlement ( locationId , settlementId , requestOptions ? ) { const req = this . createRequest ( 'GET' ) ; const mapped = req . prepareArgs ( { locationId : [ locationId , string ( ) ] , settlementId : [ settlementId , string ( ) ] , } ) ; req . appendTemplatePath `/v1/${ mapped . locationId }/settlements/${ mapped . settlementId }` ; req . deprecated ( 'V1TransactionsApi.retrieveSettlement' ) ; return req . callAsJson ( v1SettlementSchema , requestOptions ) ; } }