/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type ListTransactionsGlobals = { merchantAccountId?: string | undefined; }; export type ListTransactionsRequest = { /** * A pointer to the page of results to return. */ cursor?: string | null | undefined; /** * The maximum number of items that are at returned. */ limit?: number | undefined; /** * Filters the results to only transactions created before this ISO date-time string. The time zone must be included. Ensure that the date-time string is URL encoded, e.g. `2022-01-01T12:00:00+08:00` must be encoded as `2022-01-01T12%3A00%3A00%2B08%3A00`. */ createdAtLte?: Date | null | undefined; /** * Filters the results to only transactions created after this ISO date-time string. The time zone must be included. Ensure that the date-time string is URL encoded, e.g. `2022-01-01T12:00:00+08:00` must be encoded as `2022-01-01T12%3A00%3A00%2B08%3A00`. */ createdAtGte?: Date | null | undefined; /** * Filters the results to only transactions updated before this ISO date-time string. The time zone must be included. Ensure that the date-time string is URL encoded, e.g. `2022-01-01T12:00:00+08:00` must be encoded as `2022-01-01T12%3A00%3A00%2B08%3A00`. */ updatedAtLte?: Date | null | undefined; /** * Filters the results to only transactions updated after this ISO date-time string. The time zone must be included. Ensure that the date-time string is URL encoded, e.g. `2022-01-01T12:00:00+08:00` must be encoded as `2022-01-01T12%3A00%3A00%2B08%3A00`. */ updatedAtGte?: Date | null | undefined; search?: string | null | undefined; buyerExternalIdentifier?: string | null | undefined; buyerId?: string | null | undefined; buyerEmailAddress?: string | null | undefined; ipAddress?: string | null | undefined; /** * Filters the results to only the transactions that have a `status` that matches with any of the provided status values. */ status?: Array | null | undefined; id?: string | null | undefined; paymentServiceTransactionId?: string | null | undefined; externalIdentifier?: string | null | undefined; /** * Filters for transactions where their `metadata` values contain all of the provided `metadata` keys. The value sent for `metadata` must be formatted as a JSON string, and all keys and values must be strings. This value should also be URL encoded. */ metadata?: Array | null | undefined; /** * Filters for transactions that have an `amount` that is equal to the provided `amount_eq` value. */ amountEq?: number | null | undefined; /** * Filters for transactions that have an `amount` that is less than or equal to the `amount_lte` value. */ amountLte?: number | null | undefined; /** * Filters for transactions that have an `amount` that is greater than or equal to the `amount_gte` value. */ amountGte?: number | null | undefined; /** * Filters for transactions that have matching `currency` values. The `currency` values provided must be formatted as 3-letter ISO currency code. */ currency?: Array | null | undefined; /** * Filters for transactions that have matching `country` values. */ country?: Array | null | undefined; /** * Filters for transactions that were processed by the provided `payment_service_id` values. */ paymentServiceId?: Array | null | undefined; paymentMethodId?: string | null | undefined; paymentMethodLabel?: string | null | undefined; /** * Filters for transactions where the `payment_method_scheme` matches one of the provided values. */ paymentMethodScheme?: Array | null | undefined; /** * Filters for transactions that have a payment method with a country that matches with the provided value. */ paymentMethodCountry?: string | null | undefined; paymentMethodFingerprint?: string | null | undefined; /** * Filters for transactions that have matching `method` values. */ method?: Array | null | undefined; /** * Filters for transactions where the `error_code` matches one for the provided values. */ errorCode?: Array | null | undefined; /** * Filters for transactions with refunds. */ hasRefunds?: boolean | null | undefined; /** * Filters for transactions with a pending manual anti-fraud review. */ pendingReview?: boolean | null | undefined; /** * Filters for transactions where the `checkout_session_id` matches the provided value. */ checkoutSessionId?: string | null | undefined; /** * Filters for transactions where the `payment_link_id` matches the provided value. */ paymentLinkId?: string | null | undefined; /** * Filters for transactions where the `reconciliation_id` matches the provided value. */ reconciliationId?: string | null | undefined; /** * Filters for transactions with gift card redemptions. */ hasGiftCardRedemptions?: boolean | null | undefined; /** * Filters for transactions where a gift card used has an `id` that matches the provided value. */ giftCardId?: string | null | undefined; /** * Filters for transactions that have at least one gift card redemption where the last 4 digits of its gift card number matches exactly with the provided value. */ giftCardLast4?: string | null | undefined; /** * Filters for transactions that have at least one associated settlement record. */ hasSettlements?: boolean | null | undefined; /** * Filter for transactions that have a card with a BIN that matches exactly with the provided value. */ paymentMethodBin?: string | null | undefined; /** * Filters the results to only the transactions that have a payment source that matches with any of the provided values. */ paymentSource?: Array | null | undefined; /** * Filters for transactions where the `is_subsequent_payment` matches the provided value. */ isSubsequentPayment?: boolean | null | undefined; /** * Filters for transactions where the `merchant_initiated` matches the provided value. */ merchantInitiated?: boolean | null | undefined; /** * Filters for transactions that attempted 3DS authentication or not. */ used3ds?: boolean | null | undefined; /** * Filters for transactions that have been disputed. */ disputed?: boolean | null | undefined; /** * Filters for transactions that were reauthorized from the transaction with the provided ID. */ reauthorizedFromTransactionId?: string | null | undefined; /** * Filters the results to only get the items for which some of the buyer data contains exactly the provided `buyer_search` values. */ buyerSearch?: Array | null | undefined; /** * The ID of the merchant account to use for this request. */ merchantAccountId?: string | null | undefined; }; export type ListTransactionsResponse = { result: components.TransactionSummaries; }; /** @internal */ export type ListTransactionsRequest$Outbound = { cursor?: string | null | undefined; limit: number; created_at_lte?: string | null | undefined; created_at_gte?: string | null | undefined; updated_at_lte?: string | null | undefined; updated_at_gte?: string | null | undefined; search?: string | null | undefined; buyer_external_identifier?: string | null | undefined; buyer_id?: string | null | undefined; buyer_email_address?: string | null | undefined; ip_address?: string | null | undefined; status?: Array | null | undefined; id?: string | null | undefined; payment_service_transaction_id?: string | null | undefined; external_identifier?: string | null | undefined; metadata?: Array | null | undefined; amount_eq?: number | null | undefined; amount_lte?: number | null | undefined; amount_gte?: number | null | undefined; currency?: Array | null | undefined; country?: Array | null | undefined; payment_service_id?: Array | null | undefined; payment_method_id?: string | null | undefined; payment_method_label?: string | null | undefined; payment_method_scheme?: Array | null | undefined; payment_method_country?: string | null | undefined; payment_method_fingerprint?: string | null | undefined; method?: Array | null | undefined; error_code?: Array | null | undefined; has_refunds?: boolean | null | undefined; pending_review?: boolean | null | undefined; checkout_session_id?: string | null | undefined; payment_link_id?: string | null | undefined; reconciliation_id?: string | null | undefined; has_gift_card_redemptions?: boolean | null | undefined; gift_card_id?: string | null | undefined; gift_card_last4?: string | null | undefined; has_settlements?: boolean | null | undefined; payment_method_bin?: string | null | undefined; payment_source?: Array | null | undefined; is_subsequent_payment?: boolean | null | undefined; merchant_initiated?: boolean | null | undefined; used_3ds?: boolean | null | undefined; disputed?: boolean | null | undefined; reauthorized_from_transaction_id?: string | null | undefined; buyer_search?: Array | null | undefined; merchantAccountId?: string | null | undefined; }; /** @internal */ export const ListTransactionsRequest$outboundSchema: z.ZodType< ListTransactionsRequest$Outbound, z.ZodTypeDef, ListTransactionsRequest > = z.object({ cursor: z.nullable(z.string()).optional(), limit: z.number().int().default(20), createdAtLte: z.nullable(z.date().transform(v => v.toISOString())).optional(), createdAtGte: z.nullable(z.date().transform(v => v.toISOString())).optional(), updatedAtLte: z.nullable(z.date().transform(v => v.toISOString())).optional(), updatedAtGte: z.nullable(z.date().transform(v => v.toISOString())).optional(), search: z.nullable(z.string()).optional(), buyerExternalIdentifier: z.nullable(z.string()).optional(), buyerId: z.nullable(z.string()).optional(), buyerEmailAddress: z.nullable(z.string()).optional(), ipAddress: z.nullable(z.string()).optional(), status: z.nullable(z.array(components.TransactionStatus$outboundSchema)) .optional(), id: z.nullable(z.string()).optional(), paymentServiceTransactionId: z.nullable(z.string()).optional(), externalIdentifier: z.nullable(z.string()).optional(), metadata: z.nullable(z.array(z.string())).optional(), amountEq: z.nullable(z.number().int()).optional(), amountLte: z.nullable(z.number().int()).optional(), amountGte: z.nullable(z.number().int()).optional(), currency: z.nullable(z.array(z.string())).optional(), country: z.nullable(z.array(z.string())).optional(), paymentServiceId: z.nullable(z.array(z.string())).optional(), paymentMethodId: z.nullable(z.string()).optional(), paymentMethodLabel: z.nullable(z.string()).optional(), paymentMethodScheme: z.nullable(z.array(z.string())).optional(), paymentMethodCountry: z.nullable(z.string()).optional(), paymentMethodFingerprint: z.nullable(z.string()).optional(), method: z.nullable(z.array(components.Method$outboundSchema)).optional(), errorCode: z.nullable(z.array(z.string())).optional(), hasRefunds: z.nullable(z.boolean()).optional(), pendingReview: z.nullable(z.boolean()).optional(), checkoutSessionId: z.nullable(z.string()).optional(), paymentLinkId: z.nullable(z.string()).optional(), reconciliationId: z.nullable(z.string()).optional(), hasGiftCardRedemptions: z.nullable(z.boolean()).optional(), giftCardId: z.nullable(z.string()).optional(), giftCardLast4: z.nullable(z.string()).optional(), hasSettlements: z.nullable(z.boolean()).optional(), paymentMethodBin: z.nullable(z.string()).optional(), paymentSource: z.nullable( z.array(components.TransactionPaymentSource$outboundSchema), ).optional(), isSubsequentPayment: z.nullable(z.boolean()).optional(), merchantInitiated: z.nullable(z.boolean()).optional(), used3ds: z.nullable(z.boolean()).optional(), disputed: z.nullable(z.boolean()).optional(), reauthorizedFromTransactionId: z.nullable(z.string()).optional(), buyerSearch: z.nullable(z.array(z.string())).optional(), merchantAccountId: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { createdAtLte: "created_at_lte", createdAtGte: "created_at_gte", updatedAtLte: "updated_at_lte", updatedAtGte: "updated_at_gte", buyerExternalIdentifier: "buyer_external_identifier", buyerId: "buyer_id", buyerEmailAddress: "buyer_email_address", ipAddress: "ip_address", paymentServiceTransactionId: "payment_service_transaction_id", externalIdentifier: "external_identifier", amountEq: "amount_eq", amountLte: "amount_lte", amountGte: "amount_gte", paymentServiceId: "payment_service_id", paymentMethodId: "payment_method_id", paymentMethodLabel: "payment_method_label", paymentMethodScheme: "payment_method_scheme", paymentMethodCountry: "payment_method_country", paymentMethodFingerprint: "payment_method_fingerprint", errorCode: "error_code", hasRefunds: "has_refunds", pendingReview: "pending_review", checkoutSessionId: "checkout_session_id", paymentLinkId: "payment_link_id", reconciliationId: "reconciliation_id", hasGiftCardRedemptions: "has_gift_card_redemptions", giftCardId: "gift_card_id", giftCardLast4: "gift_card_last4", hasSettlements: "has_settlements", paymentMethodBin: "payment_method_bin", paymentSource: "payment_source", isSubsequentPayment: "is_subsequent_payment", merchantInitiated: "merchant_initiated", used3ds: "used_3ds", reauthorizedFromTransactionId: "reauthorized_from_transaction_id", buyerSearch: "buyer_search", }); }); export function listTransactionsRequestToJSON( listTransactionsRequest: ListTransactionsRequest, ): string { return JSON.stringify( ListTransactionsRequest$outboundSchema.parse(listTransactionsRequest), ); } /** @internal */ export const ListTransactionsResponse$inboundSchema: z.ZodType< ListTransactionsResponse, z.ZodTypeDef, unknown > = z.object({ Result: components.TransactionSummaries$inboundSchema, }).transform((v) => { return remap$(v, { "Result": "result", }); }); export function listTransactionsResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListTransactionsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListTransactionsResponse' from JSON`, ); }