/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { transactionsCancel } from "../funcs/transactionsCancel.js"; import { transactionsCapture } from "../funcs/transactionsCapture.js"; import { transactionsCreate } from "../funcs/transactionsCreate.js"; import { transactionsGet } from "../funcs/transactionsGet.js"; import { transactionsIncrementAuthorization } from "../funcs/transactionsIncrementAuthorization.js"; import { transactionsList } from "../funcs/transactionsList.js"; import { transactionsSync } from "../funcs/transactionsSync.js"; import { transactionsUpdate } from "../funcs/transactionsUpdate.js"; import { transactionsVoid } from "../funcs/transactionsVoid.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as components from "../models/components/index.js"; import * as operations from "../models/operations/index.js"; import { unwrapAsync } from "../types/fp.js"; import { PageIterator, unwrapResultIterator } from "../types/operations.js"; import { Actions } from "./actions.js"; import { Captures } from "./captures.js"; import { Events } from "./events.js"; import { Gr4vyRefunds } from "./gr4vyrefunds.js"; import { RefundSettlements } from "./refundsettlements.js"; import { Settlements } from "./settlements.js"; export class Transactions extends ClientSDK { private _refunds?: Gr4vyRefunds; get refunds(): Gr4vyRefunds { return (this._refunds ??= new Gr4vyRefunds(this._options)); } private _actions?: Actions; get actions(): Actions { return (this._actions ??= new Actions(this._options)); } private _events?: Events; get events(): Events { return (this._events ??= new Events(this._options)); } private _settlements?: Settlements; get settlements(): Settlements { return (this._settlements ??= new Settlements(this._options)); } private _refundSettlements?: RefundSettlements; get refundSettlements(): RefundSettlements { return (this._refundSettlements ??= new RefundSettlements(this._options)); } private _captures?: Captures; get captures(): Captures { return (this._captures ??= new Captures(this._options)); } /** * List transactions * * @remarks * Returns a paginated list of transactions for the merchant account, sorted by most recently updated. You can filter, sort, and search transactions using query parameters. */ async list( request?: operations.ListTransactionsRequest | undefined, options?: RequestOptions, ): Promise< PageIterator > { return unwrapResultIterator(transactionsList( this, request, options, )); } /** * Create transaction * * @remarks * Create a new transaction using a supported payment method. If additional buyer authorization is required, an approval URL will be returned. Duplicated gift card numbers are not supported. */ async create( transactionCreate: components.TransactionCreate, merchantAccountId?: string | null | undefined, idempotencyKey?: string | null | undefined, xForwardedFor?: string | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(transactionsCreate( this, transactionCreate, merchantAccountId, idempotencyKey, xForwardedFor, options, )); } /** * Get transaction * * @remarks * Retrieve the details of a transaction by its unique identifier. */ async get( transactionId: string, merchantAccountId?: string | null | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(transactionsGet( this, transactionId, merchantAccountId, options, )); } /** * Manually update a transaction * * @remarks * Manually updates a transaction. */ async update( transactionUpdate: components.TransactionUpdate, transactionId: string, merchantAccountId?: string | null | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(transactionsUpdate( this, transactionUpdate, transactionId, merchantAccountId, options, )); } /** * Capture transaction * * @remarks * Captures a previously authorized transaction. You can capture the full or a partial amount, as long as it does not exceed the authorized amount (unless over-capture is enabled). */ async capture( request: operations.CaptureTransactionRequest, options?: RequestOptions, ): Promise { return unwrapAsync(transactionsCapture( this, request, options, )); } /** * Void transaction * * @remarks * Voids a previously authorized transaction. If the transaction was not yet successfully authorized, or was already captured, the void will not be processed. This operation releases the hold on the buyer's funds. Captured transactions can be refunded instead. */ async void( transactionId: string, prefer?: Array | null | undefined, merchantAccountId?: string | null | undefined, idempotencyKey?: string | null | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(transactionsVoid( this, transactionId, prefer, merchantAccountId, idempotencyKey, options, )); } /** * Cancel transaction * * @remarks * Cancels a pending transaction. If the transaction was successfully authorized, or was already captured, the cancel will not be processed. */ async cancel( transactionId: string, merchantAccountId?: string | null | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(transactionsCancel( this, transactionId, merchantAccountId, options, )); } /** * Sync transaction * * @remarks * Synchronizes the status of a transaction with the underlying payment service provider. This is useful for transactions in a pending state to check if they've been completed or failed. Only available for some payment service providers. */ async sync( transactionId: string, merchantAccountId?: string | null | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(transactionsSync( this, transactionId, merchantAccountId, options, )); } /** * Increment transaction authorization * * @remarks * Increment the transaction authorization amount of a given transaction_id. */ async incrementAuthorization( transactionAuthorizationIncrementCreate: components.TransactionAuthorizationIncrementCreate, transactionId: string, merchantAccountId?: string | null | undefined, idempotencyKey?: string | null | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(transactionsIncrementAuthorization( this, transactionAuthorizationIncrementCreate, transactionId, merchantAccountId, idempotencyKey, options, )); } }