UNPKG

transbank-sdk

Version:
21 lines (20 loc) 723 B
import ApiConstants from '../../../common/api_constants'; import RequestBase from '../../../common/request_base'; class MallCreateRequest extends RequestBase { constructor(buyOrder, sessionId, returnUrl, details) { super(`${ApiConstants.WEBPAY_ENDPOINT}/transactions`, 'POST'); this.buyOrder = buyOrder; this.sessionId = sessionId; this.returnUrl = returnUrl; this.details = details; } toJson() { return JSON.stringify({ buy_order: this.buyOrder, session_id: this.sessionId, details: this.details.map((detail) => detail.toPlainObject()), return_url: this.returnUrl }); } } export { MallCreateRequest };