UNPKG

transbank-sdk

Version:
25 lines (24 loc) 863 B
import ApiConstants from '../../../common/api_constants'; import RequestBase from '../../../common/request_base'; class CreateRequest extends RequestBase { constructor(buyOrder, sessionId, amount, cvv, cardNumber, cardExpirationDate) { super(`${ApiConstants.WEBPAY_ENDPOINT}/transactions`, 'POST'); this.buyOrder = buyOrder; this.sessionId = sessionId; this.amount = amount; this.cvv = cvv; this.cardNumber = cardNumber; this.cardExprationDate = cardExpirationDate; } toJson() { return JSON.stringify({ buy_order: this.buyOrder, session_id: this.sessionId, amount: this.amount, cvv: this.cvv, card_number: this.cardNumber, card_expiration_date: this.cardExprationDate, }); } } export { CreateRequest };