/*********************************************************************************************************************** * This file is auto-generated. If you have an issue, please create a GitHub issue. * ***********************************************************************************************************************/ import {Base, FindAllResponse} from '../../base'; import {ResourcePath, ResourceNames} from '../../types'; import {Session} from '../../../lib/session/session'; import {ApiVersion} from '../../../lib/types'; interface FindArgs { session: Session; id: number | string; order_id?: number | string | null; fields?: unknown; in_shop_currency?: unknown; } interface AllArgs { [key: string]: unknown; session: Session; order_id?: number | string | null; since_id?: unknown; fields?: unknown; in_shop_currency?: unknown; } interface CountArgs { [key: string]: unknown; session: Session; order_id?: number | string | null; } export class Transaction extends Base { public static apiVersion = ApiVersion.July25; protected static hasOne: {[key: string]: typeof Base} = {}; protected static hasMany: {[key: string]: typeof Base} = {}; protected static paths: ResourcePath[] = [ {"http_method": "get", "operation": "count", "ids": ["order_id"], "path": "orders//transactions/count.json"}, {"http_method": "get", "operation": "get", "ids": ["order_id"], "path": "orders//transactions.json"}, {"http_method": "get", "operation": "get", "ids": ["order_id", "id"], "path": "orders//transactions/.json"}, {"http_method": "post", "operation": "post", "ids": ["order_id"], "path": "orders//transactions.json"} ]; protected static resourceNames: ResourceNames[] = [ { "singular": "transaction", "plural": "transactions" } ]; public static async find( { session, id, order_id = null, fields = null, in_shop_currency = null }: FindArgs ): Promise { const result = await this.baseFind({ session: session, urlIds: {"id": id, "order_id": order_id}, params: {"fields": fields, "in_shop_currency": in_shop_currency}, }); return result.data ? result.data[0] : null; } public static async all( { session, order_id = null, since_id = null, fields = null, in_shop_currency = null, ...otherArgs }: AllArgs ): Promise> { const response = await this.baseFind({ session: session, urlIds: {"order_id": order_id}, params: {"since_id": since_id, "fields": fields, "in_shop_currency": in_shop_currency, ...otherArgs}, }); return response; } public static async count( { session, order_id = null, ...otherArgs }: CountArgs ): Promise { const response = await this.request({ http_method: "get", operation: "count", session: session, urlIds: {"order_id": order_id}, params: {...otherArgs}, body: {}, entity: null, }); return response ? response.body : null; } public kind: string | null; public amount: string | null; public amount_rounding: string | null; public authorization: string | null; public authorization_expires_at: string | null; public created_at: string | null; public currency: string | null; public currency_exchange_adjustment: {[key: string]: unknown} | null; public device_id: string | null; public error_code: string | null; public extended_authorization_attributes: {[key: string]: unknown} | null; public gateway: string | null; public id: string | null; public location_id: string | null; public manual_payment_gateway: boolean | null; public message: string | null; public order_id: string | null; public parent_id: string | null; public payment_details: {[key: string]: unknown} | null; public payments_refund_attributes: {[key: string]: unknown} | null; public processed_at: string | null; public receipt: {[key: string]: unknown} | null; public source_name: string | null; public status: string | null; public test: boolean | null; public total_unsettled_set: {[key: string]: unknown} | null; public user_id: string | null; }