ts-midtrans-client
Version:
This library is an UNOFFICIAL TypeScript version of the Midtrans Client - Node.js.
65 lines (64 loc) • 2.83 kB
TypeScript
declare class SnapBi {
static ACCESS_TOKEN: string;
static PAYMENT_HOST_TO_HOST: string;
static CREATE_VA: string;
static DEBIT_STATUS: string;
static DEBIT_REFUND: string;
static DEBIT_CANCEL: string;
static VA_STATUS: string;
static VA_CANCEL: string;
static QRIS_PAYMENT: string;
static QRIS_STATUS: string;
static QRIS_REFUND: string;
static QRIS_CANCEL: string;
private paymentMethod;
private apiPath;
private accessTokenHeader;
private transactionHeader;
private body;
private accessToken;
private deviceId;
private debugId;
private timeStamp;
private timeout;
private signature;
private notificationUrlPath;
private notificationPayload;
constructor(paymentMethod: string);
static directDebit(): SnapBi;
static va(): SnapBi;
static qris(): SnapBi;
static notification(): SnapBi;
withAccessTokenHeader(headers: Record<string, string>): this;
withTransactionHeader(headers: Record<string, string>): this;
withAccessToken(accessToken: string): this;
withBody(body: any): this;
withSignature(signature: string): this;
withTimeStamp(timeStamp: string): this;
withNotificationPayload(notificationPayload: any): this;
withNotificationUrlPath(notificationUrlPath: string): this;
withPrivateKey(privateKey: string): this;
withClientId(clientId: string): this;
withClientSecret(clientSecret: string): this;
withPartnerId(partnerId: string): this;
withChannelId(channelId: string): this;
withDeviceId(deviceId: string): this;
withDebugId(debugId: string): this;
withTimeout(timeout: number | null): this;
createPayment(externalId: string): Promise<Record<string, any>>;
cancel(externalId: string): Promise<Record<string, any>>;
refund(externalId: string): Promise<Record<string, any>>;
getStatus(externalId: string): Promise<Record<string, any>>;
isWebhookNotificationVerified(): boolean;
getAccessToken(): Promise<Record<string, any>>;
createConnection(externalId?: string | null): Promise<Record<string, any>>;
static getSymmetricSignatureHmacSh512(accessToken: string, requestBody: any, method: string, path: string, clientSecret: string, timeStamp: string): string;
static getAsymmetricSignatureSha256WithRsa(clientId: string, xTimeStamp: string, privateKey: string): string;
buildSnapBiTransactionHeader(externalId: string | null, timeStamp: string): Record<string, string>;
buildAccessTokenHeader(timeStamp: string): Record<string, string>;
setupCreatePaymentApiPath(paymentMethod: string): string;
setupRefundApiPath(paymentMethod: string): string;
setupCancelApiPath(paymentMethod: string): string;
setupGetStatusApiPath(paymentMethod: string): string;
}
export default SnapBi;