@cardql/core
Version:
CardQL core SDK for payment processing - cross-platform shared logic, auth and data access
350 lines (324 loc) • 6.56 kB
text/typescript
// Core types for CardQL SDK
// Generated from GraphQL schema
export interface Address {
street1?: string;
street2?: string;
city?: string;
state?: string;
postalCode?: string;
country?: string;
}
export interface Industry {
code?: string;
name?: string;
category?: string;
mcc?: number;
}
export interface Balance {
available: number;
pending: number;
currency: string;
lastUpdated?: string;
}
export interface Card {
last4?: string;
brand?: string;
expMonth?: number;
expYear?: number;
cardType?: string;
holderName?: string;
network?: string;
funding?: string;
country?: string;
}
// GraphQL API Types
export interface Account {
id: string;
accountID: string;
name: string;
apps: App[];
}
export interface App {
id: string;
appID: string;
name: string;
apiKey: string;
}
export interface Customer {
id: string;
firstName?: string;
lastName?: string;
middleName?: string;
email?: string;
phone?: string;
address?: any; // JSON
country?: string;
status?: string;
isDeleted?: boolean;
isEnriched?: boolean;
provider?: string;
providerID?: string;
cards?: any; // JSON
merchants?: any; // JSON
createdAt?: string;
updatedAt?: string;
}
export interface Merchant {
id: string;
name: string;
descriptor?: string;
status?: string;
isKyc?: boolean;
isKyb?: boolean;
isDeleted?: boolean;
address?: any; // JSON
country?: string;
currency?: string;
beneficiaries?: any; // JSON
industry?: any; // JSON
banks?: any; // JSON
locations?: any; // JSON
balance?: any; // JSON
appID?: string;
pricingID?: string;
createdAt?: string;
updatedAt?: string;
}
export interface Payment {
id: string;
amount: string;
currency: string;
merchantID: string;
userID: string;
description?: string;
status?: string;
provider?: string;
providerID?: string;
providerAccountID?: string;
customerID?: string;
locationID?: string;
terminalID?: string;
auth?: any; // JSON
metadata?: any; // JSON
pricing?: any; // JSON
isCnp?: boolean;
capturableAmount?: string;
capturedAmount?: string;
refundableAmount?: string;
netAmount?: string;
fees?: string;
settlementStatus?: string;
settledAt?: string;
fundsAvailableAt?: string;
createdAt?: string;
updatedAt?: string;
}
export interface Ledger {
id: string;
amount: string;
currency: string;
merchantID: string;
description?: string;
direction?: string;
type?: string;
status?: string;
reference?: string;
preBalance?: string;
postBalance?: string;
isSettled?: boolean;
paymentID?: string;
metadata?: any; // JSON
createdAt?: string;
updatedAt?: string;
}
// Input types for mutations
export interface CreateAccountInput {
name: string;
}
export interface UpdateAccountInput {
id: string;
name: string;
}
export interface CreateAppInput {
accountID: string;
name: string;
}
export interface UpdateAppInput {
id: string;
name: string;
}
export interface CreateCustomerInput {
firstName?: string;
lastName?: string;
middleName?: string;
email?: string;
phone?: string;
address?: any;
country?: string;
status?: string;
isDeleted?: boolean;
isEnriched?: boolean;
provider?: string;
providerID?: string;
cards?: any;
merchants?: any;
}
export interface UpdateCustomerInput {
id: string;
firstName?: string;
lastName?: string;
middleName?: string;
email?: string;
phone?: string;
address?: any;
country?: string;
status?: string;
isDeleted?: boolean;
isEnriched?: boolean;
provider?: string;
providerID?: string;
cards?: any;
merchants?: any;
}
export interface CreateMerchantInput {
name: string;
descriptor?: string;
status?: string;
isKyc?: boolean;
isKyb?: boolean;
address?: any;
country?: string;
currency?: string;
beneficiaries?: any;
industry?: any;
banks?: any;
locations?: any;
balance?: any;
appID?: string;
pricingID?: string;
}
export interface UpdateMerchantInput {
id: string;
name?: string;
descriptor?: string;
status?: string;
isKyc?: boolean;
isKyb?: boolean;
address?: any;
country?: string;
currency?: string;
beneficiaries?: any;
industry?: any;
banks?: any;
locations?: any;
balance?: any;
appID?: string;
pricingID?: string;
}
export interface CreatePaymentInput {
amount: string;
currency: string;
merchantID: string;
userID: string;
description?: string;
status?: string;
provider?: string;
providerID?: string;
providerAccountID?: string;
customerID?: string;
locationID?: string;
terminalID?: string;
auth?: any;
metadata?: any;
pricing?: any;
isCnp?: boolean;
capturableAmount?: string;
capturedAmount?: string;
refundableAmount?: string;
netAmount?: string;
fees?: string;
settlementStatus?: string;
settledAt?: string;
fundsAvailableAt?: string;
}
export interface UpdatePaymentInput {
id: string;
amount?: string;
currency?: string;
merchantID?: string;
userID?: string;
description?: string;
status?: string;
provider?: string;
providerID?: string;
providerAccountID?: string;
customerID?: string;
locationID?: string;
terminalID?: string;
auth?: any;
metadata?: any;
pricing?: any;
isCnp?: boolean;
capturableAmount?: string;
capturedAmount?: string;
refundableAmount?: string;
netAmount?: string;
fees?: string;
settlementStatus?: string;
settledAt?: string;
fundsAvailableAt?: string;
}
export interface CreateLedgerInput {
amount: string;
currency: string;
merchantID: string;
description?: string;
direction?: string;
type?: string;
status?: string;
reference?: string;
preBalance?: string;
postBalance?: string;
isSettled?: boolean;
paymentID?: string;
metadata?: any;
}
export interface UpdateLedgerInput {
id: string;
amount?: string;
currency?: string;
merchantID?: string;
description?: string;
direction?: string;
type?: string;
status?: string;
reference?: string;
preBalance?: string;
postBalance?: string;
isSettled?: boolean;
paymentID?: string;
metadata?: any;
}
// Configuration and client types
export interface CardQLConfig {
apiKey: string;
endpoint: string;
timeout?: number;
retries?: number;
}
export interface CardQLError {
message: string;
code?: string;
details?: any;
}
export type Currency =
| "USD"
| "CAD"
| "GBP"
| "EUR"
| "JPY"
| "AUD"
| "NZD"
| "CHF"
| "SEK";
export type Country = "US" | "CA" | "GB" | "AU" | "NZ" | "JP";