transbank-sdk
Version:
Transbank SDK for Node.js
21 lines (20 loc) • 723 B
JavaScript
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 };