transbank-sdk
Version:
Transbank SDK for Node.js
66 lines (65 loc) • 2.92 kB
TypeScript
import Options from '../../common/options';
import BaseTransaction from '../../common/base_transaction';
/**
* Contains methods to interact with WebpayPlus API
*/
declare class Transaction extends BaseTransaction {
/**
* Constructor class Webpay Plus transaction.
* @param options You can pass options to use a custom configuration.
*/
constructor(options: Options);
/**
* Creates and returns an instance of `Transaction` configured for the integration environment.
*
* @param commerceCode The commerce code.
* @param apiKey The API key used for authentication.
* @return A new instance of `Transaction` configured for the test environment (Environment.Integration).
*/
static buildForIntegration(commerceCode: string, apiKey: string): Transaction;
/**
* Creates and returns an instance of `Transaction` configured for the production environment.
*
* @param commerceCode The commerce code.
* @param apiKey The API key used for authentication.
* @return A new instance of `Transaction` configured for the production environment (Environment.Production).
*/
static buildForProduction(commerceCode: string, apiKey: string): Transaction;
/**
* Create a Webpay Plus transaction.
* @param buyOrder Commerce buy order, make sure this is unique.
* @param sessionId You can use this field to pass session data if needed.
* @param amount Transaction amount
* @param returnUrl URL to which Transbank will redirect after card holder pays
*/
create(buyOrder: string, sessionId: string, amount: number, returnUrl: string): Promise<any>;
/**
* Commit a transaction, this should be invoked after the card holder pays
* @param token Unique transaction identifier
*/
commit(token: string): Promise<any>;
/**
* Obtain the status of a specific transaction
* @param token Unique transaction identifier
*/
status(token: string): Promise<any>;
/**
* Request a refund of a specific transaction, if you refund for the full amount and you're within
* the time window the transaction will be reversed. If you're past that window or refund for less
* than the total amount the transaction will be void.
* @param token Unique transaction identifier
* @param amount Amount to be refunded
*/
refund(token: string, amount: number): Promise<any>;
/** Capture a deferred transaction.
*
* Your commerce code must be configured to support deferred capture.
*
* @param token Unique transaction identifier
* @param buyOrder Transaction's buy order
* @param authorizationCode Transaction's authorization code
* @param captureAmount Amount to be captured
*/
capture(token: string, buyOrder: string, authorizationCode: string, captureAmount: number): Promise<any>;
}
export default Transaction;