@yeepay/yop-typescript-sdk
Version:
TypeScript SDK for interacting with YOP (YeePay Open Platform)
50 lines (49 loc) • 1.26 kB
TypeScript
export interface YopConfig {
appKey: string;
appPrivateKey: string;
yopPublicKey?: string | Buffer;
yopApiBaseUrl?: string;
parentMerchantNo?: string;
merchantNo?: string;
}
export interface YopResult {
code: string;
message: string;
subCode: string;
subMessage: string;
[key: string]: any;
}
export interface YopError {
code: string;
message: string;
solution?: string;
[key: string]: any;
}
export interface YopResponseMetadata {
yopSign?: string | null;
yopRequestId?: string | null;
[key: string]: string | number | null | undefined;
}
export interface YopResponse {
state: 'SUCCESS' | 'FAILURE' | string;
ts?: number;
result?: YopResult;
error?: YopError;
sign?: string;
stringResult?: string;
metadata?: YopResponseMetadata;
[key: string]: any;
}
export interface YopErrorResponse extends YopResponse {
state: 'FAILURE' | string;
error: YopError;
}
export type ContentType = 'application/json' | 'application/x-www-form-urlencoded';
export interface YopRequestOptions {
method: 'GET' | 'POST';
apiUrl: string;
params?: Record<string, unknown>;
body?: Record<string, unknown>;
contentType?: ContentType;
timeout?: number;
}