newebpay-mpg-sdk
Version:
藍新金流 幕前支付(MPG) SDK
105 lines (104 loc) • 4.3 kB
TypeScript
import { AxiosInstance } from "axios";
import { AddMerchantParams, AlterPeriodicPaymentAmountParams, AlterPeriodicPaymentAmountResponse, AlterPeriodicPaymentStatusParams, AlterPeriodicPaymentStatusResponse, CancelCreditCardParams, ChargeMerchantResult, CreatePeriodicPaymentHTMLParams, CreatePeriodicPaymentResponse, CreditCardPaymentParams, EmbeddedPaymentParams, EmbeddedPaymentResponse, EmbeddedTokenPaymentParams, GetPaymentFormHTMLParams, ModifyMerchantParams, PeriodicPaymentResponse, QueryTokenStatusParams, QueryTokenStatusResponse, QueryTradeInfoParams, RefundCreditCardParams, RefundEWalletParams, TokenPaymentParams, TokenPaymentResponse, TradeInfo, UnbindTokenParams, UnbindTokenResponse } from ".";
type NewebpayClientOptions = {
proxyEndpoint?: string;
proxySecret?: string;
userAgent?: string;
};
export declare class NewebpayClient {
partnerId: string | null;
merchantId: string;
hashKey: string;
hashIV: string;
apiEndpoint: string;
inframeEndpoint: string;
env: "sandbox" | "production";
proxyEndpoint?: string;
proxySecret?: string;
userAgent?: string;
apiInstance: AxiosInstance;
inframeInstance: AxiosInstance;
constructor(params: {
partnerId?: string;
merchantId: string;
hashKey: string;
hashIV: string;
env: "sandbox" | "production";
options?: NewebpayClientOptions;
});
parseTradeInfo(tradeInfo: string): TradeInfo;
decryptAESString(encrypted: string): string;
getPaymentFormHTML(params: GetPaymentFormHTMLParams): string;
queryTradeInfo(params: QueryTradeInfoParams): Promise<{
Status: string;
Message: string;
Result: {
[key: string]: any;
};
}>;
createPeriodicPaymentHTML(params: CreatePeriodicPaymentHTMLParams): string;
alterPeriodicPaymentStatus(params: AlterPeriodicPaymentStatusParams): Promise<AlterPeriodicPaymentStatusResponse>;
alterPeriodicPaymentAmount(params: AlterPeriodicPaymentAmountParams): Promise<AlterPeriodicPaymentAmountResponse>;
refundCreditCard(params: RefundCreditCardParams): Promise<{
Status: string;
Message: string;
Result: {
[key: string]: any;
};
}>;
cancelCreditCard(params: CancelCreditCardParams): Promise<{
Status: string;
Message: string;
Result: {
[key: string]: any;
};
}>;
refundEWallet(params: RefundEWalletParams): Promise<{
UID: string;
Version: string;
Status: string;
Message: string;
Result: {
[key: string]: any;
};
}>;
addMerchant(params: AddMerchantParams): Promise<{
status: string;
message: string;
result: {
[key: string]: any;
};
}>;
modifyMerchant(params: ModifyMerchantParams): Promise<{
status: string;
message: string;
result: {
[key: string]: any;
};
}>;
chargeMerchant(params: AddMerchantParams): Promise<ChargeMerchantResult>;
requestCreditCardPayment: (params: CreditCardPaymentParams) => Promise<TradeInfo>;
authorizeTokenPayment(params: TokenPaymentParams): Promise<TokenPaymentResponse>;
queryTokenStatus(params: QueryTokenStatusParams): Promise<QueryTokenStatusResponse>;
unbindToken(params: UnbindTokenParams): Promise<UnbindTokenResponse>;
embeddedCreditCardPayment(params: EmbeddedPaymentParams): Promise<EmbeddedPaymentResponse>;
decode3DHTML(encodedHtml: string): string;
is3DResponse(response: EmbeddedPaymentResponse): boolean;
embeddedTokenPayment(params: EmbeddedTokenPaymentParams): Promise<EmbeddedPaymentResponse>;
buildTradeInfo(params: {
[key: string]: any;
}): string;
encryptAESString(plainText: string): string;
buildTradeSha(tradeInfo: string): string;
buildCheckCode(params: {
[key: string]: any;
}): string;
buildCheckValue(params: {
[key: string]: any;
}): string;
parseCreatePeriodicPaymentResponse(rawResponse: string): CreatePeriodicPaymentResponse;
parsePeriodicPaymentResponse(rawResponse: string): PeriodicPaymentResponse;
private getTimeStamp;
private createApiInstance;
}
export default NewebpayClient;